Our topic for today is “How to change env config without rebuild app?”.
- Create .env file in root project
2. Set config in svelte.config.js
3. Convert your environment to constant
4. Install env-cmd to load .env file to environment variable
npm install env-cmd
5. use env-cmd
Conclusion
You can try to build app and run with env-cmd node build/index.js
process.env.XXX should be work. Now you can change config in .env file and restart app without rebuild app.