5/6/2023 8:26:57 PM

Are you using React Vite and have scripts that should only run in Production such as Google Tag Manager? If so, you can create Environment specific index.html files.

1. Create a folder, "buildfiles", in the root of your project.

2. Create an Environment specific subfolder in "buildfiles" (ex: "dev").

3. Create an index.html file specific to that Environment.

4. Update your package.json file to use the following "dev" and "build" scripts. These work on Windows. You may need to make command changes for Linux.

"scripts": { "dev": "copyfiles -f ./buildfiles/dev/index.html ./; vite", "build": "copyfiles -f ./buildfiles/prod/index.html ./; vite build" }