Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Babel - unknown Statement of type "ForOfStatement" #1638

Closed
shadowfoxish opened this issue Aug 23, 2024 · 2 comments
Closed

Babel - unknown Statement of type "ForOfStatement" #1638

shadowfoxish opened this issue Aug 23, 2024 · 2 comments
Labels
question Further information is requested

Comments

@shadowfoxish
Copy link

React 17 app, with webpack/babel and all that.

When I try to build/run the app with oidc-client-ts, I get the following error.

There is a work around regarding adding a 7 year old babel plugin, which introduces a deprecated dependency on core-js. I wonder if the code could be adjusted to remove the ForOfStatement in lieu of different syntax maybe?

Compiled with problems:

ERROR in ./node_modules/oidc-client-ts/dist/esm/oidc-client-ts.js

Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: C:\Code\Frontend\node_modules\oidc-client-ts\dist\esm\oidc-client-ts.js: unknown Statement of type "ForOfStatement"
    at Ep.explodeStatement (C:\Code\Frontend\node_modules\regenerator-transform\lib\emit.js:593:13)
    at C:\Code\Frontend\node_modules\regenerator-transform\lib\emit.js:325:12
    at Array.forEach (<anonymous>)
    at Ep.explodeStatement (C:\Code\Frontend\node_modules\regenerator-transform\lib\emit.js:324:22)
    at Ep.explode (C:\Code\Frontend\node_modules\regenerator-transform\lib\emit.js:282:40)
    at PluginPass.<anonymous> (C:\Code\Frontend\node_modules\regenerator-transform\lib\visit.js:108:17)
    at PluginPass.<anonymous> (C:\Code\Frontend\node_modules\regenerator-transform\lib\util.js:28:17)
    at newFn (C:\Code\Frontend\node_modules\@babel\traverse\lib\visitors.js:177:21)
    at NodePath._call (C:\Code\Frontend\node_modules\@babel\traverse\lib\path\context.js:53:20)
    at NodePath.call (C:\Code\Frontend\node_modules\@babel\traverse\lib\path\context.js:40:17)
@pamapa
Copy link
Member

pamapa commented Aug 26, 2024

Which version are you using, i do not intend to fix 7 year bugs in babel. Maybe you can patch that loop on your side. About which loop do we talk anyway?

@pamapa pamapa added the question Further information is requested label Aug 26, 2024
@shadowfoxish
Copy link
Author

Hi Pamapa, I managed to get it working "normally".

When I initially received this error, I went looking for a solution by web search, and found this comment; parcel-bundler/parcel#1269 (comment)
That lead me to the 7-year old thing.

This particular problem has been corrected more formally, by adding "@babel/plugin-transform-for-of" to the babel plugins section, and referencing "@babel/plugin-transform-for-of": "^7.24.7", in devDependencies in packages.json.

Specifically regarding your question on which bit of code was problematic, I don't know. Babel (and honestly the ts-js transpilation concept) is not something I'm well versed in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants