I am currently struggling to make my bundler compile properly. When trying to get it working, I encountered this error message in my terminal along with my webpack.config.js file.
Here is the issue reported by the terminal:
Invalid configuration object. Webpack has been initialized using a configuration object that does not align with the API schema.
- The configuration contains an unknown property 'rules'. Valid properties include:
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? }
If there are any typos, they need to be corrected.
For loader options: Starting from webpack v2.0.0, custom properties are no longer supported in the configuration.
Loaders should be updated to allow passing options through module.rules for the loader options.
Until loaders are updated, the LoaderOptionsPlugin can be used to pass these options to the loader:
plugins: [
new webpack.LoaderOptionsPlugin({
// test: /\.xxx$/, // may apply this only for some modules
options: {
rules: …
}
})