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

[Bug]: compile crash (regression?) TypeError: pass.get(...) is not a function; plugin-transform-react-jsx 7.9, helper-builder-react-jsx 7.18 #14884

Closed
1 task
jonenst opened this issue Aug 26, 2022 · 2 comments · Fixed by #14886
Labels
area: react i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@jonenst
Copy link

jonenst commented Aug 26, 2022

💻

  • Would you like to work on a fix?

How are you using Babel?

Other (Next.js, Gatsby, vue-cli, ...)

Input code

# using latest published nwb v0.25.2
$ npx nwb new react-component my-component
$ cd my-component
$ npm install
$ npm start

Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: /tmp/gg/my-component/src/index.js: pass.get(...) is not a function
    at Object.post (/tmp/gg/my-component/node_modules/@babel/plugin-transform-react-jsx/lib/transform-classic.js:48:47)
    at buildElementCall (/tmp/gg/my-component/node_modules/@babel/helper-builder-react-jsx/lib/index.js:167:12)
    at PluginPass.exit (/tmp/gg/my-component/node_modules/@babel/helper-builder-react-jsx/lib/index.js:53:24)
    at newFn (/tmp/gg/my-component/node_modules/@babel/traverse/lib/visitors.js:181:21)
    at NodePath._call (/tmp/gg/my-component/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/tmp/gg/my-component/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/tmp/gg/my-component/node_modules/@babel/traverse/lib/path/context.js:109:8)
    at TraversalContext.visitQueue (/tmp/gg/my-component/node_modules/@babel/traverse/lib/context.js:105:16)
    at TraversalContext.visitMultiple (/tmp/gg/my-component/node_modules/@babel/traverse/lib/context.js:74:17)
    at TraversalContext.visit (/tmp/gg/my-component/node_modules/@babel/traverse/lib/context.js:131:19)
    at traverseNode (/tmp/gg/my-component/node_modules/@babel/traverse/lib/traverse-node.js:24:17)
    at NodePath.visit (/tmp/gg/my-component/node_modules/@babel/traverse/lib/path/context.js:107:52)
    at TraversalContext.visitQueue (/tmp/gg/my-component/node_modules/@babel/traverse/lib/context.js:105:16)
    at TraversalContext.visitSingle (/tmp/gg/my-component/node_modules/@babel/traverse/lib/context.js:79:19)
    at TraversalContext.visit (/tmp/gg/my-component/node_modules/@babel/traverse/lib/context.js:133:19)
    at traverseNode (/tmp/gg/my-component/node_modules/@babel/traverse/lib/traverse-node.js:24:17)

$ npm ls | grep jsx
│ ├─┬ @babel/[email protected]
│ │ ├─┬ @babel/[email protected]

Configuration file name

No response

Configuration

No response

Current and expected behavior

works with:

    "@babel/helper-builder-react-jsx": "7.16.7"

doesn't work with:

    "@babel/helper-builder-react-jsx": "7.18.6"

Environment

plugin-transform-react-jsx 7.9
helper-builder-react-jsx 7.18

Possible solution

edit line 53 of node_modules/@babel/helper-builder-react-jsx/lib/index.js +53 to revert b1e73d6#diff-3670f8045f2c739225a4da543e477ae1fca436a1ab52d5fdbee5771bf5f51b2cR68

-       const callExpr = buildElementCall(path, state.file);
+       const callExpr = buildElementCall(path, file);

Additional context

it seems that the variable that was refactored in b1e73d6 (file -> state.file) in helper-builder-react-jsx/lib/index.js file was just wrongly named, because it is passed to https://github.com/babel/babel/blob/v7.9.0/packages/babel-plugin-transform-react-jsx/src/transform-classic.js#L43 which uses the get() method from state ?

@babel-bot
Copy link
Collaborator

Hey @jonenst! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

@jonenst
Copy link
Author

jonenst commented Aug 26, 2022

see insin/nwb#580

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Nov 27, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: react i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants