Merge pull request #2383 from resin-io/webpack-exclude-node

fix(webpack): Exclude all node externals / node_modules
This commit is contained in:
Jonas Hermsmeier 2018-06-08 17:36:29 +02:00 committed by GitHub
commit d1c44ab7b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

5
npm-shrinkwrap.json generated
View File

@ -9437,6 +9437,11 @@
} }
} }
}, },
"webpack-node-externals": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/webpack-node-externals/-/webpack-node-externals-1.7.2.tgz",
"dev": true
},
"webpack-sources": { "webpack-sources": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.1.0.tgz", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.1.0.tgz",

View File

@ -134,6 +134,7 @@
"simple-progress-webpack-plugin": "1.1.2", "simple-progress-webpack-plugin": "1.1.2",
"spectron": "3.7.3", "spectron": "3.7.3",
"versionist": "2.8.1", "versionist": "2.8.1",
"webpack": "github:jviotti/webpack#symlink-fix" "webpack": "github:jviotti/webpack#symlink-fix",
"webpack-node-externals": "1.7.2"
} }
} }

View File

@ -18,6 +18,7 @@
const path = require('path') const path = require('path')
const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin') const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin')
const nodeExternals = require('webpack-node-externals')
module.exports = { module.exports = {
target: 'electron-main', target: 'electron-main',
@ -33,6 +34,7 @@ module.exports = {
filename: '[name].js' filename: '[name].js'
}, },
externals: [ externals: [
nodeExternals(),
(context, request, callback) => { (context, request, callback) => {
// eslint-disable-next-line lodash/prefer-lodash-method // eslint-disable-next-line lodash/prefer-lodash-method
const absoluteContext = path.resolve(context) const absoluteContext = path.resolve(context)