Include node modules which meet one of following requirements in webpack loader:
- has
module
field engines.node > 0.10
yarn add webpack-node-modules --dev
// webpack.config.js
const path = require('path')
const nodeModules = require('webpack-node-modules')
module.exports = {
module: {
rules: [{
test: /\.js$/,
loader: 'babel-loader',
include: [
// Your app
path.join(__dirname, 'src'),
// Modules with `module` field or `engines.node > 0.10`
nodeModules()
]
}]
}
}
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
webpack-node-modules © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).
egoistian.com · GitHub @egoist · Twitter @rem_rin_rin