use*_*888 5 webpack webpack-2 angular
我正在尝试将我的 Angular 应用程序升级到 Webpack 3,并且我的 webpack 配置文件中有以下节点对象:
module.exports {
node: {
fs: 'empty',
global: 'true',
crypto: 'empty',
process: false,
module: false,
clearImmediate: false,
setImmediate: false
}
}
Run Code Online (Sandbox Code Playgroud)
我不断收到以下错误:
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
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个错误?
configuration.node.global should be a boolean.
错误中包含的上述消息表明node.global您的配置中的值的类型不正确。
更改您的配置,而不是global: 'true'您有global: true(注意没有引号,这意味着该值现在是 boolean true,而不是 string 'true')。
module.exports = {
//...
node: {
fs: 'empty',
global: true, \\ <-- quotes removed
crypto: 'empty',
process: false,
module: false,
clearImmediate: false,
setImmediate: false
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1326 次 |
| 最近记录: |