fix(webpack): Exclude all node externals / node_modules

This adds `webpack-node-externals` to exclude node_modules,
immensely reducing bundle size and avoiding complex exclusion rules
for the etcher-sdk

Change-Type: patch
This commit is contained in:
Jonas Hermsmeier 2018-06-08 16:56:21 +02:00
parent 7208ad67f1
commit 4ddac50d9b
No known key found for this signature in database
GPG Key ID: 1B870F801A0CEE9F
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": {
"version": "1.1.0",
"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",
"spectron": "3.7.3",
"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 SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin')
const nodeExternals = require('webpack-node-externals')
module.exports = {
target: 'electron-main',
@ -33,6 +34,7 @@ module.exports = {
filename: '[name].js'
},
externals: [
nodeExternals(),
(context, request, callback) => {
// eslint-disable-next-line lodash/prefer-lodash-method
const absoluteContext = path.resolve(context)