Answer the question
In order to leave comments, you need to log in
Are there several node modules included in each file by default?
I want several modules to be included in each file by default, for example, Link, etc. And it would be even better that you could configure specific modules for a specific directory, in order not to include them in each file.
How to do this?
Answer the question
In order to leave comments, you need to log in
I don’t know about directories, but you can not import them in files, for this you need to use webpack-provide-plugin
...
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.ProvidePlugin({
'React': 'react'
})
],
...
new webpack.ProvidePlugin({
'$': 'jquery',
'_': 'lodash',
'ReactDOM': 'react-dom',
'cssModule': 'react-css-modules',
'Promise': 'bluebird'
})
import ReactDOM from ‘react-dom’
import _ from 'lodash'
import $ from 'jquery'
import cssModule from 'react-css-modules'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question