Node.js 无效的配置对象。已使用与Angular V4.0.0中的API架构2不匹配的配置对象初始化Web包
我已经将webpack软件包更新为最新版本2.3.2,并且我正在使用Angular V4.0.0、typescript V2.2.2。运行“npm run build”命令时引发以下错误。在更新angular2之后,它工作得很好,因为它抛出了错误Node.js 无效的配置对象。已使用与Angular V4.0.0中的API架构2不匹配的配置对象初始化Web包,node.js,webpack-2,angular4,typescript2.2,Node.js,Webpack 2,Angular4,Typescript2.2,我已经将webpack软件包更新为最新版本2.3.2,并且我正在使用Angular V4.0.0、typescript V2.2.2。运行“npm run build”命令时引发以下错误。在更新angular2之后,它工作得很好,因为它抛出了错误 Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. -
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration has an unknown property 'htmlLoader'. These properties are valid:
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, module?, name?, node?, output?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
For typos: please correct them.
For loader options: webpack 2 no longer allows custom properties in configuration.
Loaders should be updated to allow passing options via loader options in module.rules.
Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
plugins: [
new webpack.LoaderOptionsPlugin({
// test: /\.xxx$/, // may apply this only for some modules
options: {
htmlLoader: ...
}
})
]
您应该移动html加载程序
htmlLoader: {
minimize: false
},
plugins: [
new webpack.LoaderOptionsPlugin({
options: {
htmlLoader: {
minimize: true
}
}
})
]
看看这个
在Webpack2.0中,他们已经停止支持直接加载自定义加载程序