Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !1596

(feat): add webpack validation error logging

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/johann-sonntagbauer/master into master Feb 20, 2017
  • Overview 4
  • Commits 4
  • Pipelines 0
  • Changes 2

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? }
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/johann-sonntagbauer/master