1

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 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.