Skip to content

dotenv doesn't take console environment variable #14586

Discussion options

You must be logged in to vote

You are passing the dotenv result as-is:

build: {
  env: require('dotenv').config().parsed
}

So, if .env file is missing, or you are passing env variables manually (e.g. TEST_CONFIG=FROMCONSOLE quasar dev), they won't be included in require('dotenv').config().parsed. Since you are not handling the other case, it won't work.

Vite documentation about the environment is for Vite applications. Your application is a Quasar CLI with Vite application, so you must refer to Quasar docs for that. Quasar doesn't handle .env files itself, it leaves it to your liking. In this case, you are using a hybrid dotenv and regular env setup, so you must handle it accordingly. Here is how you would do it:

// E…

Replies: 3 comments 10 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by mabujaber
Comment options

You must be logged in to vote
1 reply
@yusufkandemir
Comment options

Comment options

You must be logged in to vote
9 replies
@yusufkandemir
Comment options

@mabujaber
Comment options

@mabujaber
Comment options

@yusufkandemir
Comment options

@mabujaber
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #14584 on October 09, 2022 11:03.