Environment Variables
Rasengan.js comes with built-in support for environment variables, which allows you to do the following:
- Use
.env
to load environment variables - Bundle environment variables for the browser by prefixing with
RASENGAN_
Load Environment Variables
Rasengan.js has built-in support for loading environment variables from .env
into import.meta.env
.
.env
RASENGAN_API_URL=https://api.example.com
RASENGAN_API_KEY=abc123
RASENGAN_PORT=3000
Access to Environment Variables
Then access them like follow:
src/app/home.page.js
import.meta.env.RASENGAN_API_URL; // 'https://api.example.com'
import.meta.env.RASENGAN_API_KEY; // 'abc123'
import.meta.env.RASENGAN_PORT; // '3000'
Only variables that start with RASENGAN_
will be available in the browser.
Next steps
Configuring - Aliases