Closed patriciomartinns closed 1 year ago
I recommend getting a VPS and moving away from a hosting provider.
I believe, there's no workaround except having an additional .env.production
file and renaming them during the production build.
This would look something like that in package.json
:
{
"scripts": {
"env-production": "mv .env .env.temp && mv .env.production .env",
"env-local": "mv .env .env.production && mv .env.temp .env",
"build-production": "npm-s env-production build env-local",
}
}
I'm changing the hosting app, but for now the mentioned solution worked!
Thank you very much.
If you're using vite for the build, you can also reference the .env.production file directly:
npm run build -- --mode production
my hosting does not allow the assets to be generated in production, so I have to generate these assets on localhost, for this reason I encountered problems when using the package, having to go to the env and change the url before doing the build. Is there any way to make this process automatic?