brysgo / brysgo/babel-plugin-inline-dotenv

plugin works only once

Open
#13 16 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
123
Forks
12
PR merge metrics
No merged PRs in 30d

Description

Once installed the plugin works as expected (loading my `.env` vars in `process.env` being used in webpack and all), but after a node reload or any changes, it suddenly stops to populate `process.env`.

I can make it to "work" again either by changing in `.babelrc` the `path` option value (which I should not need, my `.env` is at the root of my repository) or by running a new `yarn install --dev babel-plugin-inline-dotenv` to clean it up, which makes me wondered if there's some sort of cache messing up here ?
Once it stops working for a specific `.env` path, it won't use it again no matter what until reinstalled.

**node version :** 9.11.1

**`package.json`** (relevant part)

"@babel/cli": "^7.0.0-beta.42",
"@babel/core": "^7.0.0-beta.42",
"@babel/node": "^7.0.0-beta.42",
"@babel/preset-env": "^7.0.0-beta.42",
"@babel/preset-react": "^7.0.0-beta.42",
"@babel/preset-stage-0": "^7.0.0-beta.42",
"@babel/register": "^7.0.0-beta.42",
"babel-plugin-dynamic-import-node": "^1.2.0",
"babel-plugin-inline-dotenv": "^1.1.2",
"babel-plugin-transform-require-ignore": "^0.1.1",

**`.babelrc`**

```json
{
"presets": [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-stage-0"
],
"plugins": [
["inline-dotenv"]
],
"env": {
"development": {
"plugins": [
"react-hot-loader/babel"
]
},
"node": {
"plugins": [
"dynamic-import-node",
[
"transform-require-ignore",
{
"extensions": [".sass", ".scss", ".less"]
}
]
]
}
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.