Parcel: Uncaught ReferenceError: regeneratorRuntime is not defined

Created on 14 Oct 2018  路  14Comments  路  Source: parcel-bundler/parcel

馃悰 bug report


When I started using generators in my code. I got the error message when running : Uncaught ReferenceError: regeneratorRuntime is not defined.

馃帥 Configuration (.babelrc, package.json, cli command)


```.babelrc
{
"plugins": [
["@babel/plugin-transform-runtime", {
"corejs": 2
}]
]
}


```json
  "devDependencies": {
    "babel-cli": "^7.0.0-beta.3",
    "babel-core": "^7.0.0-beta.3",
    "babel-plugin-transform-class-properties": "^7.0.0-beta.3",
    "babel-plugin-transform-object-assign": "^7.0.0-beta.3",
    "babel-plugin-transform-runtime": "^7.0.0-beta.3",
    "babel-preset-es2015": "^7.0.0-beta.3",
    "babel-preset-react": "^7.0.0-beta.3",
    "babel-preset-stage-0": "^7.0.0-beta.3",
    "babel-runtime": "^7.0.0-beta.3",
    "babelify": "^7.3.0",
    "parcel-bundler": "^1.10.3",
    "qunitjs": "^1.20.0"
  },
  "dependencies": {
    "babel-polyfill": "^7.0.0-beta.3"
  }

馃 Expected Behavior


generator should just work.

馃槸 Current Behavior

Uncaught ReferenceError: regeneratorRuntime is not defined
    at Object.parcelRequire.../src/index.js../helpers (index.js:4)
    at newRequire (test.e31bb0bc.js:49)
    at localRequire (test.e31bb0bc.js:55)
    at Object.parcelRequire.graph-edge-traversal.specs.js.qunitjs (graph-edge-traversal.specs.js:2)
    at newRequire (test.e31bb0bc.js:49)
    at localRequire (test.e31bb0bc.js:55)
    at Object.parcelRequire.index.js../graph-edge-traversal.specs (index.js:1)
    at newRequire (test.e31bb0bc.js:49)
    at parcelRequire.../node_modules/process/browser.js (test.e31bb0bc.js:81)
    at test.e31bb0bc.js:107

馃拋 Possible Solution


This is related to #1762. However, adding import "babel-polyfill" in my index.js made it work. I however cannot do that, I bundle with rollup and that breaks my rollup bundle.

馃敠 Context

馃捇 Code Sample


Cf. test directory
Cf. package.json

馃實 Your Environment

    "babel-runtime": "^7.0.0-beta.3",
    "parcel-bundler": "^1.10.3",

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.10.3
| Node | 8.2.0
| npm/Yarn | npm
| Operating System | windows 10

Bug

Most helpful comment

how to solve ?

If you are targeting modern browsers, a simple solution is to add the browserslist property to your package.json file

{
    "name": "my-app",
    ...
    "browserslist": [
        "last 1 Chrome versions"
    ],
    ...
}

Note: you can change last 1 to last 2 or 3 or however far back you decide to go

All 14 comments

I've had the same issue. Downgrading to [email protected] solved it.

Same problem!

Closing as it's a duplicate

how to solve ?

how to solve ?

If you are targeting modern browsers, a simple solution is to add the browserslist property to your package.json file

{
    "name": "my-app",
    ...
    "browserslist": [
        "last 1 Chrome versions"
    ],
    ...
}

Note: you can change last 1 to last 2 or 3 or however far back you decide to go

how to solve ?

If you are targeting modern browsers, a simple solution is to add the browserslist property to your package.json file

{
    "name": "my-app",
    ...
    "browserslist": [
        "last 1 Chrome versions"
    ],
    ...
}

Note: you can change last 1 to last 2 or 3 or however far back you decide to go

Hey! I did it, but still the issue.

@andreamendi
Can you post your package.json file

@felipemullen 's solution worked for me , thx mate 馃憤

@felipemullen by update the package.json the issue get solved i'm curio where is the this documented 馃槃

It doesn't appear to be documented within on the parcel website, but looking at the npm package it appears to depend on babel, and babel in turn has a dependency on the browserslist package, which uses that configuration.

You can read more about it and how to configure properly here:
https://github.com/browserslist/browserslist

 "browserslist": [
        "last 1 Chrome versions"
    ],

does not solve the issue if you need to debug for safari

"browserslist": [
        "last 1 Chrome versions"
    ],

this solved problem for me. @felipemullen thank you!

Add to your package.json"browserslist": [ "last 2 Chrome versions" ]

you can change the browser you're using, It doesn't have to be only chrome

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Niggler picture Niggler  路  3Comments

dsky1990 picture dsky1990  路  3Comments

466023746 picture 466023746  路  3Comments

devongovett picture devongovett  路  3Comments

dotdash picture dotdash  路  3Comments