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

I have been instructed to put some instructions inside the webpack.config.js file.However in my create

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?

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?

Share asked Oct 7, 2019 at 12:11 prestonpreston 4,36710 gold badges54 silver badges89 bronze badges 1
  • Create react app suggests this article as a way to configure your app without having to eject (Source) – apokryfos Commented Oct 7, 2019 at 12:22
Add a ment  | 

3 Answers 3

Reset to default 4

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

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./facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-eject

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743666452a4487051.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信