Reputation: 5563
When building a React (with usual react-scripts
/create-creact-app
etc.) app via npm build
, I always get the entry file in build/index.html
.
I've tried moving the src
into a subfolder, but the index.js
is required to be there in src/index.js
.
So how can I change the output path of the index.html
?
I.e. e.g. I want to rename it to index.htm
, because I am have a pedantic quirk, or I want to change the output path to build/srv/www/index.html
?
(These are just examples.)
Upvotes: 4
Views: 10121
Reputation: 194
To change the output path you need to change the webpack config, and in create-react-path is not possible unless you run the eject script.
This way:
npm run eject
After running it, you will be able to access to any project configuration (webpack config in your case), but you must know, once the project is ejected, you can't go back.
More information here:
Upvotes: 3