At /src/visitors/globals.js:26, Parcel is recognizing DotEnv's call to process.env.hasOwnProperty(...) and is attempting to convert it to a node, causing the babel converter to throw an exception.
.babelrc
{
    "presets": [
        ["env", {
            "targets": {
                "browsers": ["last 1 Chrome version"]
            }
        }]
    ]
}
package.json
{
  "name": "StormStarter",
  "version": "1.0.0",
  "main": "out/index.js",
  "repository": "https://github.com/EricRabil/StormStarter.git",
  "author": "EricRabil <[email protected]>",
  "license": "MIT",
  "dependencies": {
    "babel-polyfill": "^6.26.0",
    "bcrypt": "^2.0.1",
    "biguint-format": "^1.0.0",
    "cookie-parser": "^1.4.3",
    "express": "^4.16.3",
    "express-session": "^1.15.6",
    "flake-idgen": "^1.1.0",
    "fs-extra": "^6.0.0",
    "keymirror": "^0.1.1",
    "mongodb": "^3.0.7",
    "nobi": "^0.0.1",
    "parcel": "^1.8.1",
    "passport": "^0.4.0",
    "passport-local": "^1.0.0",
    "passport-unique-token": "^0.1.4",
    "pug": "^2.0.3",
    "superagent": "^3.8.3",
    "typeorm": "^0.2.5",
    "uws": "^10.148.0",
    "vue": "^2.5.16",
    "vue-hot-reload-api": "^2.3.0",
    "vue-router": "^3.0.1",
    "webpack": "^4.7.0",
    "winston": "2.4.0"
  },
  "devDependencies": {
    "@vue/component-compiler-utils": "^1.3.0",
    "babel-plugin-transform-runtime": "^6.23.0",
    "node-sass": "^4.9.0",
    "typescript": "^2.8.3",
    "vue-template-compiler": "^2.5.16"
  }
}
cli
parcel watch index.html -d ../../out/frontend
It should be able to compile
It throws the above error due to DotEnv
/Users/ericrabil/eric.git/StormStarter/node_modules/dotenv/lib/main.js: don't know how to turn this value into a node
    at Object.valueToNode (/Users/ericrabil/.config/yarn/global/node_modules/babel-types/lib/converters.js:349:9)
    at MemberExpression (/Users/ericrabil/.config/yarn/global/node_modules/parcel-bundler/src/visitors/globals.js:26:25)
    at c (/Users/ericrabil/.config/yarn/global/node_modules/babylon-walk/lib/index.js:149:9)
    at c (/Users/ericrabil/.config/yarn/global/node_modules/babylon-walk/lib/index.js:186:9)
    at c (/Users/ericrabil/.config/yarn/global/node_modules/babylon-walk/lib/index.js:186:9)
    at c (/Users/ericrabil/.config/yarn/global/node_modules/babylon-walk/lib/index.js:186:9)
    at c (/Users/ericrabil/.config/yarn/global/node_modules/babylon-walk/lib/index.js:183:11)
    at c (/Users/ericrabil/.config/yarn/global/node_modules/babylon-walk/lib/index.js:186:9)
    at c (/Users/ericrabil/.config/yarn/global/node_modules/babylon-walk/lib/index.js:183:11)
    at c (/Users/ericrabil/.config/yarn/global/node_modules/babylon-walk/lib/index.js:186:9)
In /src/visitors/globals.js at the MemberExpressions definition, check whether the inline access to process.env is a function call, and if so, do not attempt to coerce it to a node.
The issue affects me by preventing the build process from completing.
I am spawning a parcel instance through child_process however the error occurs when running it from a standard CLI. I am compiling a TypeScript/Vue project and redirecting it to another directory.
https://github.com/EricRabil/StormStarter
| Software         | Version(s) |
| ---------------- | ---------- |
| Parcel           | 1.7.1, 1.8.1
| Node             | 10.2.1, 8.9.0
| npm/Yarn         | 1.7.0
| Operating System | macOS 10.13.4
Had the same error in this project.
https://github.com/Tag-it/image-tagger/commit/3f9490efa2ff787aed940766835a472c4a05625c
@Ronnie1734 does yours still repro / have you found a fix?
Anyone?
@EricRabil Hello. Just tried to use parcel and it can't load dotenv. To repro you need just two lines of code:
import dotenv from 'dotenv'
dotenv.config()
Getting the same error when trying to use dotenv in my project when running parcel too.
@TrueCarry @jchu4483
Having same issue, have you been lucky solving it pls?
EDIT: Not a fix, but quick workaround is to use dotenv v4.0.0 - works well
https://github.com/motdotla/dotenv/releases/tag/v4.0.0
Same here, impossible to use dotenv with parcel. Any update on that subject?
Most helpful comment
Getting the same error when trying to use
dotenvin my project when running parcel too.