Skip to content

Experimental scope hoisting: Cannot read property 'constantViolations' of undefined #1538

@marcesengel

Description

@marcesengel

🐛 bug report

I tried to build my React project with the new experimental scope hoisting enabled (--experimental-scope-hoisting) and it crashed (works without the feature enabled).

🎛 Configuration

cli:
parcel build src/index.html --out-dir dist --public-url ./dist/ --no-cache --experimental-scope-hoisting

.babelrc:

{
  "presets": [
    "env",
    "react"
  ],
  "plugins": [
    [ "transform-runtime", {
      "helpers": false,
      "polyfill": false,
      "regenerator": true,
      "moduleName": "babel-runtime"
    } ],
    "styled-components",
    "transform-object-rest-spread",
    "transform-class-properties",
    "transform-async-to-generator",
    "inline-react-svg",
    "react-intl"
  ]
}

🤔 Expected Behavior

Parcel bundles my application.

😯 Current Behavior

Parcel didn't bundle my application.

Stacktrace:

🚨  /Users/user/development/project/src/shared/services/LanguageService.js: Cannot read property 'constantViolations' of undefined
    at rename (/Users/user/development/project/node_modules/parcel-bundler/src/scope-hoisting/renamer.js:9:33)
    at JSAsset.ImportDeclaration (/Users/user/development/project/node_modules/parcel-bundler/src/scope-hoisting/hoist.js:325:7)
    at NodePath._call (/Users/user/development/project/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (/Users/user/development/project/node_modules/babel-traverse/lib/path/context.js:48:17)
    at NodePath.visit (/Users/user/development/project/node_modules/babel-traverse/lib/path/context.js:105:12)
    at TraversalContext.visitQueue (/Users/user/development/project/node_modules/babel-traverse/lib/context.js:150:16)
    at TraversalContext.visitMultiple (/Users/user/development/project/node_modules/babel-traverse/lib/context.js:103:17)
    at TraversalContext.visit (/Users/user/development/project/node_modules/babel-traverse/lib/context.js:190:19)
    at Function.traverse.node (/Users/user/development/project/node_modules/babel-traverse/lib/index.js:114:17)
    at NodePath.visit (/Users/user/development/project/node_modules/babel-traverse/lib/path/context.js:115:19)

🔦 Context

My LanguageService contains some dynamic imports and has only one import (browser-locale) - maybe it's related to the dynamic imports or to that package in particular?

🌍 Your Environment

Software Version(s)
Parcel 1.9.0
Node 8.9.1
npm/Yarn npm 6.1.0
Operating System macOS High Sierra

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions