Skip to content

Commit fecb4ae

Browse files
authored
feat: default to not include node globals anf builtins (#578)
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 closes ipfs/js-ipfs#2924 BREAKING CHANGE: browser code will NOT have node globals and builtins available.
1 parent 5c76f64 commit fecb4ae

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

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
@@ -89,11 +89,6 @@ module.exports = {
8989
describe: 'If true, unhandledRejection events will cause tests to fail',
9090
type: 'boolean',
9191
default: true
92-
},
93-
node: {
94-
type: 'boolean',
95-
describe: 'Flag to control when to tell the bundler to include node global packages.',
96-
default: true
9792
}
9893
})
9994
},

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)