parcel: Uncaught ReferenceError: regeneratorRuntime is not defined
๐ 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)
{
"plugins": [
["@babel/plugin-transform-runtime", {
"corejs": 2
}]
]
}
"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 |
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 20
- Comments: 15 (1 by maintainers)
If you are targeting modern browsers, a simple solution is to add the
browserslistproperty to yourpackage.jsonfileNote: you can change
last 1tolast 2or 3 or however far back you decide to goClosing as itโs a duplicate
how to solve ?
Hey! I did it, but still the issue.
Iโve had the same issue. Downgrading to
parcel@1.9solved it.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
does not solve the issue if you need to debug for safari
Duplicate? https://github.com/parcel-bundler/parcel/issues/1762
this solved problem for me. @felipemullen thank you!
It doesnโt appear to be documented within on the parcel website, but looking at the npm package it appears to depend on
babel, andbabelin turn has a dependency on thebrowserslistpackage, which uses that configuration.You can read more about it and how to configure properly here: https://github.com/browserslist/browserslist