Webpack 迁移问题
Webpack Migration Issue
我正在尝试将我的 Angular 应用程序升级到 Webpack 3,我的 webpack 配置文件中有以下节点对象:
module.exports {
node: {
fs: 'empty',
global: 'true',
crypto: 'empty',
process: false,
module: false,
clearImmediate: false,
setImmediate: false
}
}
我不断收到以下错误:
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
如何解决这个错误?
configuration.node.global should be a boolean.
错误中包含的上述消息表明您配置中 node.global
的值类型不正确。
更改您的配置,使 global: 'true'
变成 global: true
(注意没有引号,这意味着该值现在是布尔值 true
,而不是字符串 'true'
).
module.exports = {
//...
node: {
fs: 'empty',
global: true, \ <-- quotes removed
crypto: 'empty',
process: false,
module: false,
clearImmediate: false,
setImmediate: false
}
}
我正在尝试将我的 Angular 应用程序升级到 Webpack 3,我的 webpack 配置文件中有以下节点对象:
module.exports {
node: {
fs: 'empty',
global: 'true',
crypto: 'empty',
process: false,
module: false,
clearImmediate: false,
setImmediate: false
}
}
我不断收到以下错误:
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
如何解决这个错误?
configuration.node.global should be a boolean.
错误中包含的上述消息表明您配置中 node.global
的值类型不正确。
更改您的配置,使 global: 'true'
变成 global: true
(注意没有引号,这意味着该值现在是布尔值 true
,而不是字符串 'true'
).
module.exports = {
//...
node: {
fs: 'empty',
global: true, \ <-- quotes removed
crypto: 'empty',
process: false,
module: false,
clearImmediate: false,
setImmediate: false
}
}