babel / babel/minify

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

Open
#941 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.4k
Forks
217
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.