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

pass.get(...) is not a function in @babel/plugin-transform-react-jsx #12478

Closed
jacktomlinson opened this issue Dec 10, 2020 · 10 comments · Fixed by #12479
Closed

pass.get(...) is not a function in @babel/plugin-transform-react-jsx #12478

jacktomlinson opened this issue Dec 10, 2020 · 10 comments · Fixed by #12479
Labels
area: react i: bug i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@jacktomlinson
Copy link

Bug Report

Hi there 👋 So from this morning around 08:30GMT we are seeing the following error when we try to compile our code with Rollup. Here is the stack trace that we are seeing.....

image

It looks to be able the same time you published an update to @babel/plugin-transform-react-jsx recently.

Here is the setup of Babel packages we are using.

"@babel/cli": "7.2.0",
"@babel/core": "7.2.0",
"@babel/eslint-parser": "^7.11.3",
"@babel/plugin-proposal-class-properties": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.6.0",
"@babel/plugin-transform-spread": "7.2.0",
"@babel/preset-env": "7.2.0",
"@babel/preset-react": "7.0.0",
"babel-core": "7.0.0-bridge.0",
"babel-loader": "8.0.4",
"babel-plugin-add-react-displayname": "0.0.5",
"babel-plugin-file-loader": "1.1.1",
"babel-plugin-inline-import-data-uri": "1.0.1",
"babel-plugin-inline-react-svg": "1.1.0",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-transform-replace-object-assign": "^2.0.0",

Is there anything you suggest we should do instead?

Environment


  • Node/npm version: 10.15.3
  • OS: Windows
  • Monorepo: No
  • How you are using Babel: Rollup
@babel-bot
Copy link
Collaborator

Hey @jacktomlinson! 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."

@nicolo-ribaudo
Copy link
Member

Could you provide the input code and config that trigger this error?

@jacktomlinson
Copy link
Author

Hey @nicolo-ribaudo ! Yeah sure...

We believe it was coming from this file.

import arrow from './arrow.svg';

export {
    arrow,
};

With this babel config....

module.exports = (api) => {
    api.cache(true);
    const presets = [
        ['@babel/preset-env', {
            targets: {
                ie: 9
            }
        }],
        '@babel/preset-react'
    ];
    const plugins = [
        '@babel/plugin-transform-spread',
        '@babel/plugin-proposal-class-properties',
        '@babel/plugin-transform-runtime',
        'add-react-displayname',
        'inline-react-svg',
        ['inline-import-data-uri', {
            extensions: [
                '.html',
                '.svg',
                '.png',
                '.jpg'
            ]
        }]
    ];
    return {
        presets,
        plugins
    };
};

@nicolo-ribaudo
Copy link
Member

Could you also share the contents of arrow.svg and the version of babel-plugin-inline-react-svg? I'm getting some unrelated errors from that plugin while trying to reproduce this bug.

@jacktomlinson
Copy link
Author

Sure...

<?xml version="1.0" encoding="UTF-8"?>
<svg width="18px" height="22px" viewBox="0 0 18 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <title>CBBB799B-32FC-47EB-9B9C-18F19ABB1780</title>
    <defs>
        <path d="M14.3328269,1.18151571 L20.7479059,7.59659466 C20.9130288,7.76171763 21.0423341,7.94902103 21.1356664,8.14889997 C21.248758,8.37028715 21.3206325,8.61723524 21.340856,8.87946331 L21.3467206,9.03223405 C21.3467206,9.67590655 21.0357121,10.2464554 20.5524744,10.5999068 L14.3328269,16.8184843 C13.5769822,17.574329 12.3470125,17.5744051 11.5884372,16.8158298 C10.8245732,16.0519658 10.8286734,14.8285493 11.5857827,14.07144 L11.5857827,14.07144 L14.6812154,10.9746291 L2.5764561,10.9746877 C1.49992016,10.9746877 0.627215354,10.1125008 0.627215354,9.03223405 C0.627215354,7.95944654 1.49112776,7.08978043 2.5764561,7.08978043 L14.7472154,7.08962912 L11.5857827,3.92855995 C10.8286734,3.17145068 10.8245732,1.9480342 11.5884372,1.18417023 C12.3470125,0.42559491 13.5769822,0.42567101 14.3328269,1.18151571 Z" id="path-1"></path>
    </defs>
    <g id="Mobile" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <g id="320-SP---Car---Flow-1.2.1" transform="translate(-207.000000, -495.000000)">
            <g id="Modal-Copy" transform="translate(12.000000, 24.000000)">
                <g id="Car-Button-/-Medium-/-Secondary" transform="translate(64.000000, 460.000000)">
                    <g id="Group-6" transform="translate(16.000000, 10.000000)">
                        <g id="Icon/Pencil" transform="translate(124.000000, 12.000000) rotate(90.000000) translate(-124.000000, -12.000000) translate(113.000000, 3.000000)">
                            <mask id="mask-2" fill="white">
                                <use xlink:href="#path-1"></use>
                            </mask>
                            <use id="Combined-Shape-Copy" fill="#FFFFFF" xlink:href="#path-1"></use>
                            <g id="↳-Icon-fill" mask="url(#mask-2)" fill="#108A00">
                                <g transform="translate(-1.000000, -3.000000)" id="Rectangle">
                                    <rect x="0" y="0" width="24" height="24"></rect>
                                </g>
                            </g>
                        </g>
                    </g>
                </g>
            </g>
        </g>
    </g>
</svg>

And babel-plugin-inline-react-svg is at "1.1.0" @nicolo-ribaudo

@nicolo-ribaudo
Copy link
Member

Ok I am able to reproduce the bug, thanks!

@jacktomlinson
Copy link
Author

Nice! Sweet, great work!

@jacktomlinson
Copy link
Author

Hey @nicolo-ribaudo thanks so much for a fast response on this - is there any chance we could get a new release out with this?

@nicolo-ribaudo
Copy link
Member

Probably later today or tomorrow. As a workaround you can install an older version of @babel/plugin-transform-react-jsx

@jacktomlinson
Copy link
Author

Wicked thanks - will give that a go 👍

@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 Mar 13, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: react i: bug 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.

3 participants