question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid webpack configuration object error on build

See original GitHub issue

I’m following the create-react-app example. My code can be found here (incase you’d like to reference it directly). When I run the start script, everything works as expected. When I run my build script, however, I get the following:

$ react-app-rewired build
Creating an optimized production build...
Failed to compile.

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.module.rules[1].oneOf[0].use should be one of these:
   non-empty string | function | object { loader?, options?, query? } | function | [non-empty string | function | object { loader?, options?, query? }]
   Details:
    * configuration.module.rules[1].oneOf[0].use should be a string.
    * configuration.module.rules[1].oneOf[0].use should be an instance of function.
    * configuration.module.rules[1].oneOf[0].use should be an object.
    * configuration.module.rules[1].oneOf[0].use should be one of these:
      non-empty string | function | object { loader?, options?, query? }
    * configuration.module.rules[1].oneOf[0].use should be an instance of function.
    * configuration.module.rules[1].oneOf[0].use[0] should be a string.
    * configuration.module.rules[1].oneOf[0].use[0] should be an instance of function.
    * configuration.module.rules[1].oneOf[0].use[0] has an unknown property 'include'. These properties are valid:
      object { loader?, options?, query? }
    * configuration.module.rules[1].oneOf[0].use[0] should be one of these:
      non-empty string | function | object { loader?, options?, query? }


error Command failed with exit code 1.

Any suggestions on how to fix the build process? Thank you!!! Please let me know if you have any questions.

Kind regards,

Harry

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
harrysolovaycommented, Aug 28, 2018

You’re completely right! I was improperly configuring the use of a .babelrc. Thank you!

0reactions
silvenoncommented, Aug 27, 2018

Our example doesn’t have invalid webpack configuration. It fails on build though (whoops) because of @rebass/markdown, but that’s a different story.

So I don’t think MDX is really a problem in your case, it’s just one of the variables in your configuration. You need to retrace your steps, carefully study how to properly override CRA and learn to read webpack’s configuration errors because they are very helpful. Remove piece by piece until you pinpoint the location of the error, and if you’re still stuck find out if there’s a CRA support channel where you can ask for help.

I’ve never really used CRA, so it would probably take me a long time to find out what the solution to your problem is.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid configuration object. Webpack has been initialised ...
This error usually happens when you have conflicting version (angular js). So the webpack could not start the application ...
Read more >
Invalid configuration object. Webpack has been ... - GitHub
Webpack has been initialised using a configuration object that does not match the API schema. - configuration.module.rules[3].type should be one ...
Read more >
Invalid configuration object. Webpack has been ... - Reddit
Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
Read more >
invalid configuration object. webpack has been initialized ...
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. Invalid configuration object.
Read more >
Webpack has been initialized using a configuration object
I just install a new laravel project ( laravel and PHP 8) laravel new laravue Then I install laravel/ui after the package installed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found