babel / minify

:scissors: An ES6+ aware minifier based on the Babel toolchain (beta)
https://babeljs.io/repl
MIT License
4.4k stars 225 forks source link

Undefined variables using babel-plugin-transform-inline-environment-variables in nuxtjs #941

Open aaaguirrep opened 5 years ago

aaaguirrep commented 5 years ago

I am using the module babel-plugin-transform-inline-environment-variables in nuxt project but it shows undefined variables. I am running the command in the package.json as "dev": "cross-env VAR1=xxxxx VAR2=yyyyyy nuxt", I see the variables at server side but in the client side it shows as undefined.

To Reproduce

I print the varibles as: console.log(process.env.VAR1) or console.log(process.env.VAR2) In the .babelrc i have the next code: { "env": { "development": { "plugins": [ [ "transform-inline-environment-variables", { "include": [ "VAR1", "VAR2" ] } ] ] } } }

My current environment is: nuxt:2.4.2 yarn:1.13.0 node:11.8.0 babel-plugin-transform-inline-environment-variable: 0.4.3 babel-core: 7.0.0-bridge.0

Actual Output undefined