0

Initially, I am using the create-react-app which during build produces 2 JS files after build, one is the main and the other one is the chunk.

But what if I would like after build to create only one bundle JS file? The create-react starter has already webpack and babel in it.

So what is the way to go? To add a configuration? To install webpack again?

1 Answer 1

0

First option is to eject the create-react-app and modify the webpack config manually. But ejecting is an irreversible action, and usually not recommended.

A better option is to use react-app-rewired tool. react-app-rewired allows to modify the webpack config without ejecting:

/* Create a file config-overrides.js */

module.exports = function override(config, env) {
  //do stuff with the webpack config...
  return config;
}
Sign up to request clarification or add additional context in comments.

1 Comment

Hm, I like CRA. But those cases, which I am currently also experiencing, drive me to not using CRA. A good setup is explained here. And don't be afraid to eject, if you still want to use CRA.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.