preston
preston

Reputation: 4337

Where to place webpack.config.js in create-react-app project

I have been instructed to put some instructions inside the webpack.config.js file. However in my create-react-app project I cannot find that file. Currently the available answer on StackOverFlow requires ejecting the project which I think will break my project. Is it possible to use webpack.config.js inside a create-react-app project without ejecting? Where is the webpack.config.js file? or where should I put it?

Upvotes: 3

Views: 10935

Answers (3)

Cereal
Cereal

Reputation: 3839

create-react-app hides the config files from you. If you want to modify them, you have to run npm run eject. This will place them under the config/ folder.

Please read this before you do this, as this isn't a reversible action: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-eject

Upvotes: 4

DSCH
DSCH

Reputation: 2376

You would probably want to use Craco. It allows you to override create-react-app configurations. Other than that eject is a good option and it doesn't suppose to break your app

Upvotes: 3

Javad Khodadadi
Javad Khodadadi

Reputation: 408

Webpack config used by create-react-app is here: https://github.com/facebook/create-react-app/tree/master/packages/react-scripts/config

Upvotes: 4

Related Questions