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) {
|
||||
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'],
|
||||
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
|
||||
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: {
|
||||
rules: [{
|
||||
|
@ -150,10 +163,7 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in
|
|||
},
|
||||
node: {
|
||||
__dirname: 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
|
||||
__filename: false
|
||||
},
|
||||
optimization: {
|
||||
minimize: env.mode === 'production',
|
||||
|
|
|
@ -30,11 +30,14 @@ template("webpack_build") {
|
|||
args = [
|
||||
"--config",
|
||||
rebase_path(invoker.config_file),
|
||||
"--output-filename=" + get_path_info(invoker.out_file, "file"),
|
||||
"--output-path=" + rebase_path(get_path_info(invoker.out_file, "dir")),
|
||||
"--env.buildflags=" +
|
||||
rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
||||
"--env.mode=" + mode,
|
||||
"--output-filename",
|
||||
get_path_info(invoker.out_file, "file"),
|
||||
"--output-path",
|
||||
rebase_path(get_path_info(invoker.out_file, "dir")),
|
||||
"--env",
|
||||
"buildflags=" + rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
||||
"--env",
|
||||
"mode=" + mode,
|
||||
]
|
||||
deps += [ "//electron/buildflags" ]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue