Skip to content

Commit 58c76b7

Browse files
committed
feat: default to not include node stuff
This PR changes webpack config to not include node globals and built-ins by default. For now theres still a --node flag to allow node globals if needed. `process` is still includes because `readable-stream` will only remove it in v4 nodejs/readable-stream#435 BREAKING CHANGE: browser code will NOT have node globals and builtins available.
1 parent 0ac32a5 commit 58c76b7

4 files changed

Lines changed: 9 additions & 11 deletions

File tree

cli.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ cli
3434
default: false,
3535
alias: 'debug'
3636
})
37+
// TODO remove after webpack 5 upgrade
38+
.options('node', {
39+
type: 'boolean',
40+
describe: 'Flag to control if bundler should inject node globals or built-ins.',
41+
default: false
42+
})
3743
.help()
3844
.alias('h', 'help')
3945
.alias('v', 'version')

cmds/build.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ module.exports = {
1010
yargs
1111
.epilog(EPILOG)
1212
.options({
13-
node: {
14-
type: 'boolean',
15-
describe: 'Flag to control when to tell the bundler to include node global packages.',
16-
default: true
17-
},
1813
bundlesize: {
1914
alias: 'b',
2015
type: 'boolean',

cmds/test.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,6 @@ module.exports = {
9494
describe: 'If true, unhandledRejection events will cause tests to fail',
9595
type: 'boolean',
9696
default: true
97-
},
98-
node: {
99-
type: 'boolean',
100-
describe: 'Flag to control when to tell the bundler to include node global packages.',
101-
default: true
10297
}
10398
})
10499
},

src/config/webpack.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ const base = (env, argv) => {
124124
tls: false,
125125
child_process: false,
126126
console: false,
127-
process: true, // TODO remove this once readable-stream is fixed
127+
// TODO remove this once readable-stream is fixed probably on in v4
128+
// https://github.com/nodejs/readable-stream/pull/435
129+
process: true,
128130
Buffer: false,
129131
setImmediate: false,
130132
os: false,

0 commit comments

Comments
 (0)