parcel: unknown Statement of type "ForOfStatement"
π bug report
π Configuration (.babelrc, package.json, cli command)
package.json
{
"scripts": {
"dev": "parcel ./src/index.html -d build/ --target=browser"
}
}
.babelrc
{
"presets": ["react"],
"plugins": ["react-hot-loader/babel"]
}
π€ Expected Behavior
It bundles and transpiles my es6 targetting node_module dependencies
π― Current Behavior
regenerator-transform fails because it finds a for-of statement within a generator.
Γ C:\git\my_webapp\node_modules\@private\core\dist\iterables.js: C:/git/my_webapp/node_modules/@private/core/dist/iterables.js: unknown Statement of type "ForOfStatement"
at Emitter.Ep.explodeStatement (C:\git\my_webapp\node_modules\regenerator-transform\lib\emit.js:648:13)
at C:\git\my_webapp\node_modules\regenerator-transform\lib\emit.js:344:12
at Array.forEach (<anonymous>)
at Emitter.Ep.explodeStatement (C:\git\my_webapp\node_modules\regenerator-transform\lib\emit.js:343:22)
at Emitter.Ep.explode (C:\git\my_webapp\node_modules\regenerator-transform\lib\emit.js:298:40)
at PluginPass.exit (C:\git\my_webapp\node_modules\regenerator-transform\lib\visit.js:122:15)
at newFn (C:\git\my_webapp\node_modules\babel-traverse\lib\visitors.js:276:21)
at NodePath._call (C:\git\my_webapp\node_modules\babel-traverse\lib\path\context.js:76:18)
at NodePath.call (C:\git\my_webapp\node_modules\babel-traverse\lib\path\context.js:48:17)
at NodePath.visit (C:\git\my_webapp\node_modules\babel-traverse\lib\path\context.js:117:8)
π Possible Solution
According to https://github.com/facebook/regenerator/issues/229 for-of statements need to be transformed before regenerator-transform can be applied. Maybe there is a way to force this.
π Your Environment
| Software | Version(s) |
|---|---|
| Parcel | 1.7.1 |
| Node | 9.11.1 |
| npm/Yarn | 1.6.0 |
| Operating System | Win 7 64bit |
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 9
- Comments: 22 (2 by maintainers)
I was facing into this error only when I use
ipfsmodule, but FWIW now I found a workaround: inpackage.jsonsetting likesolved the issue for me (idea from https://github.com/ipfs/js-ipfs/blob/master/examples/browser-parceljs/package.json).
Sorry for the pollution but if you end up here due to googling, itβs likely due to browserslist removing βIE 11β from the defaults (4 hours ago as of now) and the short term fix is to add back
IE 11to your list of browsers as it is no longer included indefaults.This fixed my issue. Cheers.
@yuhr Thanks ran into the same problem when using ipfs. Almost switched to webpack after seeing this https://github.com/orbitdb/example-orbitdb-todomvc-updated
I start getting this in parcel v1.11.0 if I import
p-memoize.Adding βbabel-plugin-transform-es2015-for-ofβ: β^6.23.0β in package.json and compiling it first in babel config π plugins: [ β@babel/plugin-transform-for-ofβ, β¦ worked
That didnβt solve things for me. My problem persists:
@tehraven @yuhr may have fixed the issue, but the code youβre shipping would not be supported by IE11. Iβm still struggling with this problem, and I really need to support IE. Any help here?