[Build] Invalid configuration object: unknown property 'loaders'
OS: Arch Linux as of 22.06.2018
after $npm install.
$ npm run build:dist
> [email protected] build:dist /home/user/nuclear
> webpack --progress --colors --env=prod --define process.env.NODE_ENV=production && cp loader.css dist
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.module has an unknown property 'loaders'. These properties are valid:
object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, noParse?, rules?, defaultRules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp?, strictExportPresence?, strictThisContextOnImports? }
-> Options affecting the normal modules (`NormalModuleFactory`).
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:dist: `webpack --progress --colors --env=prod --define process.env.NODE_ENV=production && cp loader.css dist`
npm ERR! Exit status 1
Problem also shows up when running npm run watch
This is probably because the configs are incompatible with Webpack 4. Looking at package.json, it specifies version 4 point something, which is incorrect. I'll take a look after the weekend and resolve it.
I fixed this problem temporaily for me by downgrading to webpack 3.1.4 and also downgrading webpack-dev-server to 3.0.0 since it relied on Webpack 4.
Well, downgrading never seems like a strategically right choice cause it tends to cause all sorts of troubles for users over time. In Arch ecosystem no good package sets caps on dependency versions because of this. Considered a bad practice. "Either be a good pack or a dead pack."
It is more like the configs need to be updated and not Webpack downgraded.
I think you can just replace 'loaders' with 'rules' and it'll work with Webpack 4.