5

I am trying to upgrade my Angular Application to Webpack 3 and I have the following node object in my webpack config file:

module.exports {

  node: {
  fs: 'empty',
global: 'true',
crypto: 'empty',
process: false,
module: false,
clearImmediate: false,
setImmediate: false
}

}

I keep on getting the following error:

 Invalid configuration object. Webpack has been initialised using a 
configuration object that does not match the API schema.
 - configuration.node should be one of these:
  false | object { Buffer?, __dirname?, __filename?, console?, global?, 
process?, ... }
 -> Include polyfills or mocks for various node stuff.
Details:
* configuration.node should be false
* configuration.node.global should be a boolean.
  -> Include a polyfill for the 'global' variable

How can I solve this error?

user1107888
  • 1,481
  • 5
  • 34
  • 55

1 Answers1

2

configuration.node.global should be a boolean.

The above message contained in the error indicates the value of node.global in your configuration is of the incorrect type.

Change your configuration so that instead of global: 'true' you have global: true (notice no quotes, which means the value is now the boolean true, not the string 'true').

module.exports = {
  //...
  node: {
    fs: 'empty',
    global: true, \\ <-- quotes removed
    crypto: 'empty',
    process: false,
    module: false,
    clearImmediate: false,
    setImmediate: false
  }
}
sdgluck
  • 24,894
  • 8
  • 75
  • 90