When I started using generators in my code. I got the error message when running : Uncaught ReferenceError: regeneratorRuntime is not defined
.
```.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"
}
generator should just work.
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
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.
Cf. test directory
Cf. package.json
"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
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 yourpackage.json
file{ "name": "my-app", ... "browserslist": [ "last 1 Chrome versions" ], ... }
Note: you can change
last 1
tolast 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
Most helpful comment
If you are targeting modern browsers, a simple solution is to add the
browserslist
property to yourpackage.json
fileNote: you can change
last 1
tolast 2
or 3 or however far back you decide to go