-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nuxt RuntimeConfig ignore .env file #679
Comments
This problem is more related to Nuxt than to my template. Maybe Nuxt only reads the .env file from the project root. |
Hi @michalzaq12 thanks for your feedback. I'll endup use the @nuxt/dotenv module if i can't figure it out but its doesn't feel right to use a module when there's a framework feature design for the same purpose. EDIT:
in your template i found a file with similar code (nuxt config setup i guess) to the file in the link below but couldn't find the dotenv config. should i try to implement the same behaviour ? |
I ran into a similar issue and ended up adding my env vars to the |
Hey, thanks for the cool template !
While using it encountered an issue where apparently the runtime configuration don't read the content of the my
.env
file.Here is a little description
problem:
When i put an environement variable in
[project-root]/src/renderer/.env
and assign its value to a property of thePublicRuntimeConfig
object innuxt.config.js
i'm then unable to retrieve the value of this property in the$config
variable of my.vue
conponent.How to reproduce:
npm install -g vue-cli
vue init michalzaq12/electron-nuxt <project-name>
Install dependencies and run your app
cd <project-name>
yarn install
create .env file in [project-root]/src/renderer/.env and set an env variable
ASSETS_URL=http://assets.com/
edit file nuxt.config.js to add
PublicRuntimeConfig
object as a property to the root of the config objectedit a .vue page component to print the $config.assetsURL variable
run project
yarn run dev
Result:
the printed config variable show 'test'
Expected Result
the printed config variable should show "http://assets.com/"
Nuxt.js:2.15.4
Vue.js:2.6.12
Electron:12.0.5
Node:14.16.0
Chrome:89.0.4389.128
Platform:linux
The text was updated successfully, but these errors were encountered: