I am using Create-React-App template as boilerplate template. When npm run build command is executed, it generates a index.html file. Is there a way to rename this file to default.html as part of build process by adding configuration in package.json file?
1 Answer
If you throw something similar to this code into a javascript file you can execute it at the end of the build.
Say you called the js file rename.js and it's in the same directory that you're running the npm command from you would add && node rename at the end of the build script command in package.json.
1 Comment
Matias Kinnunen
You can also use the
mv command at the end of the build script in package.json: "build": "react-scripts build && mv build/index.html build/default.html". Then there's no need to create the rename.js file.