无效的configuration对象。 Webpack已经使用与Angular V4.0.0中的API模式2不匹配的configuration对象进行初始化

我已经更新了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. - 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 } } }) ] 

看看这个链接

在webpack 2.0中,他们停止了直接加载自定义加载器的支持。

Interesting Posts