build: upgrade webpack and related deps (#34990)
This commit is contained in:
parent
2b96d06960
commit
3baf713648
5 changed files with 631 additions and 2126 deletions
|
@ -75,9 +75,17 @@ module.exports = ({
|
||||||
|
|
||||||
if (targetDeletesNodeGlobals) {
|
if (targetDeletesNodeGlobals) {
|
||||||
plugins.push(new webpack.ProvidePlugin({
|
plugins.push(new webpack.ProvidePlugin({
|
||||||
process: ['@electron/internal/common/webpack-provider', 'process'],
|
Buffer: ['@electron/internal/common/webpack-provider', 'Buffer'],
|
||||||
global: ['@electron/internal/common/webpack-provider', '_global'],
|
global: ['@electron/internal/common/webpack-provider', '_global'],
|
||||||
Buffer: ['@electron/internal/common/webpack-provider', 'Buffer']
|
process: ['@electron/internal/common/webpack-provider', 'process']
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Webpack 5 no longer polyfills process or Buffer.
|
||||||
|
if (!alwaysHasNode) {
|
||||||
|
plugins.push(new webpack.ProvidePlugin({
|
||||||
|
Buffer: ['buffer', 'Buffer'],
|
||||||
|
process: 'process/browser'
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +137,12 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in
|
||||||
// Force timers to resolve to our dependency that doesn't use window.postMessage
|
// Force timers to resolve to our dependency that doesn't use window.postMessage
|
||||||
timers: path.resolve(electronRoot, 'node_modules', 'timers-browserify', 'main.js')
|
timers: path.resolve(electronRoot, 'node_modules', 'timers-browserify', 'main.js')
|
||||||
},
|
},
|
||||||
extensions: ['.ts', '.js']
|
extensions: ['.ts', '.js'],
|
||||||
|
fallback: {
|
||||||
|
// We provide our own "timers" import above, any usage of setImmediate inside
|
||||||
|
// one of our renderer bundles should import it from the 'timers' package
|
||||||
|
setImmediate: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [{
|
rules: [{
|
||||||
|
@ -150,10 +163,7 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in
|
||||||
},
|
},
|
||||||
node: {
|
node: {
|
||||||
__dirname: false,
|
__dirname: false,
|
||||||
__filename: false,
|
__filename: false
|
||||||
// We provide our own "timers" import above, any usage of setImmediate inside
|
|
||||||
// one of our renderer bundles should import it from the 'timers' package
|
|
||||||
setImmediate: false
|
|
||||||
},
|
},
|
||||||
optimization: {
|
optimization: {
|
||||||
minimize: env.mode === 'production',
|
minimize: env.mode === 'production',
|
||||||
|
|
|
@ -30,11 +30,14 @@ template("webpack_build") {
|
||||||
args = [
|
args = [
|
||||||
"--config",
|
"--config",
|
||||||
rebase_path(invoker.config_file),
|
rebase_path(invoker.config_file),
|
||||||
"--output-filename=" + get_path_info(invoker.out_file, "file"),
|
"--output-filename",
|
||||||
"--output-path=" + rebase_path(get_path_info(invoker.out_file, "dir")),
|
get_path_info(invoker.out_file, "file"),
|
||||||
"--env.buildflags=" +
|
"--output-path",
|
||||||
rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
rebase_path(get_path_info(invoker.out_file, "dir")),
|
||||||
"--env.mode=" + mode,
|
"--env",
|
||||||
|
"buildflags=" + rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
||||||
|
"--env",
|
||||||
|
"mode=" + mode,
|
||||||
]
|
]
|
||||||
deps += [ "//electron/buildflags" ]
|
deps += [ "//electron/buildflags" ]
|
||||||
|
|
||||||
|
|
12
package.json
12
package.json
|
@ -27,12 +27,13 @@
|
||||||
"@types/stream-json": "^1.5.1",
|
"@types/stream-json": "^1.5.1",
|
||||||
"@types/temp": "^0.8.34",
|
"@types/temp": "^0.8.34",
|
||||||
"@types/uuid": "^3.4.6",
|
"@types/uuid": "^3.4.6",
|
||||||
"@types/webpack": "^4.41.21",
|
"@types/webpack": "^5.28.0",
|
||||||
"@types/webpack-env": "^1.16.3",
|
"@types/webpack-env": "^1.17.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.4.1",
|
"@typescript-eslint/eslint-plugin": "^4.4.1",
|
||||||
"@typescript-eslint/parser": "^4.4.1",
|
"@typescript-eslint/parser": "^4.4.1",
|
||||||
"asar": "^3.1.0",
|
"asar": "^3.1.0",
|
||||||
"aws-sdk": "^2.814.0",
|
"aws-sdk": "^2.814.0",
|
||||||
|
"buffer": "^6.0.3",
|
||||||
"check-for-leaks": "^1.2.1",
|
"check-for-leaks": "^1.2.1",
|
||||||
"colors": "1.4.0",
|
"colors": "1.4.0",
|
||||||
"dotenv-safe": "^4.0.4",
|
"dotenv-safe": "^4.0.4",
|
||||||
|
@ -57,6 +58,7 @@
|
||||||
"minimist": "^1.2.6",
|
"minimist": "^1.2.6",
|
||||||
"null-loader": "^4.0.0",
|
"null-loader": "^4.0.0",
|
||||||
"pre-flight": "^1.1.0",
|
"pre-flight": "^1.1.0",
|
||||||
|
"process": "^0.11.10",
|
||||||
"remark-cli": "^10.0.0",
|
"remark-cli": "^10.0.0",
|
||||||
"remark-preset-lint-markdown-style-guide": "^4.0.0",
|
"remark-preset-lint-markdown-style-guide": "^4.0.0",
|
||||||
"semver": "^5.6.0",
|
"semver": "^5.6.0",
|
||||||
|
@ -69,8 +71,8 @@
|
||||||
"ts-loader": "^8.0.2",
|
"ts-loader": "^8.0.2",
|
||||||
"ts-node": "6.2.0",
|
"ts-node": "6.2.0",
|
||||||
"typescript": "^4.5.5",
|
"typescript": "^4.5.5",
|
||||||
"webpack": "^4.43.0",
|
"webpack": "^5.73.0",
|
||||||
"webpack-cli": "^3.3.12",
|
"webpack-cli": "^4.10.0",
|
||||||
"wrapper-webpack-plugin": "^2.1.0"
|
"wrapper-webpack-plugin": "^2.1.0"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
|
@ -146,4 +148,4 @@
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"nan": "nodejs/nan#16fa32231e2ccd89d2804b3f765319128b20c4ac"
|
"nan": "nodejs/nan#16fa32231e2ccd89d2804b3f765319128b20c4ac"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,10 +48,10 @@ const main = async () => {
|
||||||
const child = cp.spawn('node', [
|
const child = cp.spawn('node', [
|
||||||
'./node_modules/webpack-cli/bin/cli.js',
|
'./node_modules/webpack-cli/bin/cli.js',
|
||||||
'--config', `./build/webpack/${webpackTarget.config}`,
|
'--config', `./build/webpack/${webpackTarget.config}`,
|
||||||
'--display', 'errors-only',
|
'--stats', 'errors-only',
|
||||||
`--output-path=${tmpDir}`,
|
'--output-path', tmpDir,
|
||||||
`--output-filename=${webpackTarget.name}.measure.js`,
|
'--output-filename', `${webpackTarget.name}.measure.js`,
|
||||||
'--env.PRINT_WEBPACK_GRAPH'
|
'--env', 'PRINT_WEBPACK_GRAPH'
|
||||||
], {
|
], {
|
||||||
cwd: path.resolve(__dirname, '..')
|
cwd: path.resolve(__dirname, '..')
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue