user1107888
user1107888

Reputation: 1525

Webpack Migration Issue

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?

Upvotes: 5

Views: 1802

Answers (1)

sdgluck
sdgluck

Reputation: 27217

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
  }
}

Upvotes: 2

Related Questions