Created by: johann-sonntagbauer
Webpack validates the configuration during setup. If there are problems detected, it will throw a validation error. The problem is, that the build and start scripts don't print the messages.
Main cause for this particular problem is when users eject and modify the webpack config.
Only valid for webpack2 builds.
fixes https://github.com/facebookincubator/create-react-app/issues/1595
Error logging before this change:
$ npm run build
> combined@1.0.0 build C:\Projects\combined
> node scripts/build.js
Creating an optimized production build...
C:\Projects\combined\node_modules\webpack\lib\webpack.js:19
throw new WebpackOptionsValidationError(webpackOptionsValidationErrors);
^
Error
at webpack (C:\Projects\combined\node_modules\webpack\lib\webpack.js:19:9)
at build (C:\Projects\combined\scripts\build.js:125:3)
at recursive (C:\Projects\combined\scripts\build.js:72:3)
at C:\Projects\combined\node_modules\recursive-readdir\index.js:37:14
at FSReqWrap.oncomplete (fs.js:111:15)
Error logging after this change:
$ npm run build
> combined@1.0.0 build C:\Projects\combined
> node scripts/build.js
Creating an optimized production build...
Failed to configure webpack.
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration has an unknown property 'devtoo'. 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: {
devtoo: ...
}
})
]
- configuration.resolve has an unknown property 'fallback'. These properties are valid:
object { alias?, aliasFields?, cachePredicate?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, symlinks?, unsafeCache?, useSyncFileSystemCalls? }