Javascript 绑定程序错误无效的配置对象。已使用与API架构不匹配的配置对象初始化Web包
正在尝试编译我的bundler。但是,我得到了这个错误[这是我的webpack.config.js文件 这就是终端所说的Javascript 绑定程序错误无效的配置对象。已使用与API架构不匹配的配置对象初始化Web包,javascript,webpack,Javascript,Webpack,正在尝试编译我的bundler。但是,我得到了这个错误[这是我的webpack.config.js文件 这就是终端所说的 Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration has an unknown property 'rules'. These propertie
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration has an unknown property 'rules'. These properties are valid:
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, externals?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, serve?, stats?, target?, watch?, watchOptions? }
For typos: please correct them.
For loader options: webpack >= v2.0.0 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: {
rules: …
}
})
]我解决了我的问题。Webpack不处理es6,所以您必须添加babel。巴贝尔将es6转换为es5。这里有一个指向我的repo的链接,我在这里详细介绍了如何在一个香草javascript项目中使用babel设置网页包