Search code examples
node.jsreactjsnpmcreate-react-app

Rename index.html file generated from npm run build - Create-React-App


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?


Solution

  • 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.