mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-27 21:26:38 +00:00
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:
parent
7208ad67f1
commit
4ddac50d9b
5
npm-shrinkwrap.json
generated
5
npm-shrinkwrap.json
generated
@ -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",
|
||||||
|
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user