This project is an official Quasar v1 CLI App Extension for dotenv.
quasar-app-extension-dotenv is a CLI App Extension
for Quasar Framework v1. It will not work with legacy versions of Quasar Framework.
This work is currently in beta
and there are expected changes while things get worked out. Your help with testing is greatly appreciated.
In demo folder of app-extension-dotenv.
Can be found here.
To add this App Extension to your Quasar application, run the following (in your Quasar app folder):
quasar ext add @quasar/dotenv
Which will retrieve it from NPM and install it.
You will be asked a few questions. Type in your answers:
? What is the name of your .env that you will be using for development builds? .env.dev
? What is the name of your .env that you will be using for production builds? .env.prod
? What name would you like to use for your Common Root Object ('none' means to not use one)? none
? Create your .env files for you? Yes
? For security, would you like your .env files automatically added to .gitignore? Yes
Selecting [enter]
on your keyboard will give you the defaults. The env file will be .env
and there will be no common root object.
If you do not want your .env files created for you, say no. However, if the specified .env file already exists, it will NOT be overwritten. Note that if the files do not exist, then the build will fail.
Also, it is highly recommended to add your .env files to your .gitignore. They really do not belong in your repository as they may hold sensitive data.
Any data in a .env
will be placed in process.env
at the browser level.
If you specified a common root object, say MyData
, then the data will be placed at process.env.MyData
.
Be aware, if you have something like this in your .env
:
APP_PORT=4000
Then you will need to use the parseInt()
function as it will be propogated to the browser code as a string.
quasar ext remove @quasar/dotenv
If you like (and use) this App Extension, please consider becoming a Quasar Patreon.