Skip to content

Commit

Permalink
feat: default to not include node globals anf builtins (#578)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hugomrdias authored Jun 16, 2020
1 parent 5c76f64 commit fecb4ae
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
6 changes: 6 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ cli
default: false,
alias: 'debug'
})
// TODO remove after webpack 5 upgrade
.options('node', {
type: 'boolean',
describe: 'Flag to control if bundler should inject node globals or built-ins.',
default: false
})
.help()
.alias('h', 'help')
.alias('v', 'version')
Expand Down
5 changes: 0 additions & 5 deletions cmds/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ module.exports = {
yargs
.epilog(EPILOG)
.options({
node: {
type: 'boolean',
describe: 'Flag to control when to tell the bundler to include node global packages.',
default: true
},
bundlesize: {
alias: 'b',
type: 'boolean',
Expand Down
5 changes: 0 additions & 5 deletions cmds/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ module.exports = {
describe: 'If true, unhandledRejection events will cause tests to fail',
type: 'boolean',
default: true
},
node: {
type: 'boolean',
describe: 'Flag to control when to tell the bundler to include node global packages.',
default: true
}
})
},
Expand Down
4 changes: 3 additions & 1 deletion src/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ const base = (env, argv) => {
tls: false,
child_process: false,
console: false,
process: true, // TODO remove this once readable-stream is fixed
// TODO remove this once readable-stream is fixed probably on in v4
// https://github.com/nodejs/readable-stream/pull/435
process: true,
Buffer: false,
setImmediate: false,
os: false,
Expand Down

0 comments on commit fecb4ae

Please sign in to comment.