lepikhinb / momentum-trail

MIT License
74 stars 11 forks source link

generate routes for production #4

Closed patriciomartinns closed 1 year ago

patriciomartinns commented 1 year ago

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?

lepikhinb commented 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",
  }
}
patriciomartinns commented 1 year ago

I'm changing the hosting app, but for now the mentioned solution worked!

Thank you very much.

ballet-mecanique commented 1 month ago

If you're using vite for the build, you can also reference the .env.production file directly:

npm run build -- --mode production