mirror of
https://github.com/scratchfoundation/scratch-webpack-configuration.git
synced 2024-11-23 16:17:50 -05:00
feat!: externalize node_modules
This commit is contained in:
parent
9a7dc96a74
commit
c4caa9369a
3 changed files with 21 additions and 3 deletions
16
package-lock.json
generated
16
package-lock.json
generated
|
@ -9,7 +9,8 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lodash.merge": "^4.6.2"
|
"lodash.merge": "^4.6.2",
|
||||||
|
"webpack-node-externals": "^3.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@babel/preset-env": "^7.24.0",
|
"@babel/preset-env": "^7.24.0",
|
||||||
|
@ -3185,6 +3186,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/webpack-node-externals": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/webpack-node-externals/-/webpack-node-externals-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/webpack-sources": {
|
"node_modules/webpack-sources": {
|
||||||
"version": "3.2.3",
|
"version": "3.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz",
|
||||||
|
@ -5580,6 +5589,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"webpack-node-externals": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/webpack-node-externals/-/webpack-node-externals-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ=="
|
||||||
|
},
|
||||||
"webpack-sources": {
|
"webpack-sources": {
|
||||||
"version": "3.2.3",
|
"version": "3.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz",
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
"webpack": "^5.90.3"
|
"webpack": "^5.90.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lodash.merge": "^4.6.2"
|
"lodash.merge": "^4.6.2",
|
||||||
|
"webpack-node-externals": "^3.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
const merge = require('lodash.merge');
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
|
const merge = require('lodash.merge');
|
||||||
|
const nodeExternals = require('webpack-node-externals');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {import('webpack').Configuration} Configuration
|
* @typedef {import('webpack').Configuration} Configuration
|
||||||
* @typedef {import('webpack').RuleSetRule} RuleSetRule
|
* @typedef {import('webpack').RuleSetRule} RuleSetRule
|
||||||
|
@ -103,6 +105,7 @@ class ScratchWebpackConfigBuilder {
|
||||||
if (target.startsWith('node')) {
|
if (target.startsWith('node')) {
|
||||||
this.merge({
|
this.merge({
|
||||||
externalsPresets: {node: true},
|
externalsPresets: {node: true},
|
||||||
|
externals: [nodeExternals()],
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(this._distPath, 'node')
|
path: path.resolve(this._distPath, 'node')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue