简体   繁体   中英

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM