sausin posted a new question
dotenv-module •
Is there a way to reference to another variable? dotenv-expand seems to be the package that is used in general, but I am not sure if it's straightforward to just plug it in.
Any guidance would be appreciated.
Thanks!
hartmut-co-uk posted a new question
dotenv-module •
Hi @JulienTant
I just created https://cmty.app/nuxt/dotenv-module/issues/c33
also commented on https://cmty.app/nuxt/dotenv-module/issues/c28
Further I'd also opt for the .env file to override existing values from nuxt.config.js env
.
Which contradicts existing test: test('variables from the .env file should NOT override existing values from nuxt.config.js', async () => {
Topics:
.env
variables > nuxt.config.js
'env' propertyhide
| serverSideOnly
?)It comes down to a discussion on how the dotenv module / override should functionally behave. So might be somewhat opinionated… - therefore I'd simply like to start a discussion with this post. :-)
hartmut-co-uk posted a new bug report
dotenv-module •
https://codesandbox.io/s/awesome-sanderson-vijy1
console.log server Terminal
/home | fetch() | from server
/home | fetch() | process.env.TEST1 TEST1
/home | fetch() | context.env.TEST1 undefined
/home | fetch() | process.env.TEST2 TEST2
/home | fetch() | context.env.TEST2 TEST2
/home | fetch() | process.env.TEST3 undefined
/home | fetch() | context.env.TEST3 undefined
console.log client Console (toggle route '/about' <> '/')
/home | fetch() | from client
/home | fetch() | process.env.TEST1 undefined
/home | fetch() | context.env.TEST1 undefined
/home | fetch() | process.env.TEST2 TEST2
/home | fetch() | context.env.TEST2 TEST2
/home | fetch() | process.env.TEST3 undefined
/home | fetch() | context.env.TEST3 undefined
console.log server Terminal
/home | fetch() | from server
/home | fetch() | process.env.TEST1 undefined
/home | fetch() | context.env.TEST1 undefined
/home | fetch() | process.env.TEST2 TEST2
/home | fetch() | context.env.TEST2 TEST2
/home | fetch() | process.env.TEST3 undefined
/home | fetch() | context.env.TEST3 undefined
console.log client Console (toggle route '/about' <> '/')
/home | fetch() | from client
/home | fetch() | process.env.TEST1 undefined
/home | fetch() | context.env.TEST1 undefined
/home | fetch() | process.env.TEST2 TEST2
/home | fetch() | context.env.TEST2 TEST2
/home | fetch() | process.env.TEST3 undefined
/home | fetch() | context.env.TEST3 undefined
I'd expect to have control over environment variables visibility via 'only' option.
E.g. with .env
file
STRIPE_SECRET_KEY="1234"
STRIPE_PUBLISHABLE_KEY="9876"
and configuring ['@nuxtjs/dotenv', { only: ['STRIPE_PUBLISHABLE_KEY'] }]
both variables should be available server-side - while client-side only STRIPE_PUBLISHABLE_KEY
should be accessible.
proArtex posted a new bug report
dotenv-module •
VUEAPPA=A
VUEAPPAB=$VUEAPPA/B
VUEAPPA=A
VUEAPPAB=A/B
VUEAPPA=A
VUEAPPAB=$VUEAPPA/B
This works fine in vue-cli SPA, but doesn't work in nuxt. I assume they both use the same library, but nuxt is missing something.
GitGangGuy posted a new question
dotenv-module •
So in my project (https://github.com/GitGangGuy/nuxtjs-quickstarter), which consists of the scaffolded folder structure with the inital pre-configuration of the create nuxt-app cli tool and a few additions (cypress, .yml instead of .js config files, extending the .env …), I'm encountering a problem with the dotenv module for NuxtJS. In case anybody goes through the effort of cloning the repo (thanks for your effort ;) ), please note that you will have to comment out lines 55-110 in the nuxt.config.js (Currently not working CSS Modules support, see https://stackoverflow.com/questions/59347628/nuxtjs-with-css-modules-through-vue-style-loader-causes-unexplainable-error).
Anyway, I am not able to access the process variable from a Vue component (as to be seen in /pages/index.vue ).
Even after adding a
data() {
return {
title: process.env.TITLE,
description: process.env.DESCRIPTION,
};
}
block to the export default
of that page and changing the variables in the curly brackets accordingly.
My .env is as follows:
TITLE=Here's a great title!
DESCRIPTION=Here is a very, very long description
What am I doing wrong?
mateusavila posted a new question
dotenv-module •
Hi
In my project, I needed to use 2 .env files, like:
.env.development
.env.production
Using the main module, only get the default .env file. How I get the correct .env in correct environment?
powerlimit posted a new question
dotenv-module •
Is it possible to merge env files? For example, I have .env and .env.local files in my project. .env is the main file which is used in production mode. In development mode I want use the same .env file, but with overwriting some properties from .env.local file. How can i do this?
z0w13 posted a new feature request
dotenv-module •
In most places where dotenv is used system env vars override the dotenv vars, however dotenv-module does the exact opposite, swapping this around would give the expected result when using systemvars: true
ricardogobbosouza posted a new feature request
dotenv-module •
Run CircleCI on PRs
skyrpex posted a new bug report
dotenv-module •
https://couldnt-get-codesandbox-to-work
I'm using yarn 1.17.3 and dotenv-module 1.3.0. (problem also occurs on npm)
Install those and try using systemvars: true
. No vars will be loaded.
This is what I get when building the dist/index.js
file myself, which is OK:
if (options.systemvars) {
Object.keys(process.env).map(function (key) {
if (!(key in envConfig)) {
envConfig[key] = process.env[key];
}
});
}
But this is what I get when installing the package:
if (options.systemvars) {
Object.keys(process.env).map(function (key) {
if (!key in envConfig) {
envConfig[key] = process.env[key];
}
});
}
The condition always returns false and no vars are loaded.
kendavila posted a new question
dotenv-module •
Can you update this section: https://github.com/nuxt-community/dotenv-module#using-env-file-in-nuxtconfigjs? You are showing a commonjs approach but the latest version of nuxt, the nuxt.config.js uses an ESM approach.
gtso86 posted a new question
dotenv-module •
When I use .env in vue projects I can choose which .env I want to use when I build the app. How I can do the same using nuxt dotenv-module?
What I already tried:
create a new scripts passing NODEENV without success
"scripts": {
"staging": "NODEENV=staging nuxt build",
}
What I should do to use multiple .env files for each environment?
gkshi posted a new question
dotenv-module •
Hello. I want to use global environment variables in my .env file like that:
APIURL=${APIURL}
The variable declaration is higher (in docker-compose.yml).
The value must be an url. But in process.env on the client side I see not parsed string:
console.log(process.env.APIURL) // ${APIURL}
How can I set values in .env correctly? Thank you for your help.
trentpeterson posted a new feature request
dotenv-module •
Currently, if the only
option is specified with an empty array, default logic is used and all values are placed into context.env
and thus provided to the client.
I think that an empty array should signal that I do not want anything copied into context.env
. If I do not specify an only
option/array at all, I would expect the default behavior to apply and all values would be placed into context.env
.
As a workaround, I specify a name in the array that doesn't correspond to any key:
['@nuxtjs/dotenv', { only: ['nothing'] }],
Related, I agree with this comment on #7 that there should be a warning that all values are available on the client unless only
is used.
This configuration
['@nuxtjs/dotenv', { only: [] }],
results in nothing in .env
going into context.env
.
megusta420 posted a new bug report
dotenv-module •
output of .env file vars array
empty object "{}"
nuxt version "nuxt": "^2.0.0",
beardedpayton posted a new bug report
dotenv-module •
https://github.com/beardedpayton/paytonburdette.com-v2
Install module
npm i nuxtjs/dotenv
** cant include the @ symbol here, it thinks I'm trying to tag a user in the issue
Require module in nuxt.config.js
require('dotenv').config()
Add module to modules array in nuxt.config.js
modules: ["@nuxtjs/dotenv"]
Use "module in codebase with process.env.ENVVARNAME
Works as expected locally. I can read from my .env file fine.
When deploying to Netlify and using build environment variables, I should be able to read from those variables within my project.
I cannot read variables from my build environment variables established with Netlify. I can only read from them if a .env file is present.
aloiseau17 posted a new question
dotenv-module •
Hi,
I tried to use nuxt-dotenv with fileaname custom options like that:
modules: [
['@nuxtjs/dotenv', {
filename: '.env.dev',
}],
],
It's working fine in my app but not in my nuxt-config.js
I import dotenv at the top:
require('dotenv').config()
Before that I had to add the dotenv dependency to my package.json.
But the custom .env file wasn't read. Only .env is working.
PrimozRome posted a new question
dotenv-module •
I have .env file in my root Nuxt.js project but the variables are not read into process.env. ž
I have added the module following the instruction here https://github.com/nuxt-community/dotenv-module. Module looks to be loaded properly but process.env is empty object.
Any idea why?
beardedpayton posted a new question
dotenv-module •
I saw the comment here: https://github.com/nuxt-community/dotenv-module/issues/13#issuecomment-375957024
When the env file is not present in my dist folder, my env variables are not working. Everything works as expected locally.
ScreamZ posted a new question
dotenv-module •
Hello @JulienTant,
This is release in code since months (https://github.com/nuxt-community/dotenv-module/commit/3e2696341dcde954f510c48e669bd207794393d2)
but not on npm… (dist folder is not up to date) "version": "1.1.1"
{
modules: [
['@nuxtjs/dotenv', { filename: '.env.prod' }],
]
}
Could you please update repositories.
Regards