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

how to get rid of regenerator runtime errors (I don't want that polyfill) #9971

Open
DrYSG opened this issue May 13, 2019 · 8 comments

Comments

Projects
None yet
3 participants
@DrYSG
Copy link

commented May 13, 2019

I continue to get:

App.jsx:11 Uncaught ReferenceError: regeneratorRuntime is not defined

on any line that does an async. I don't what that polyfill, but I am having a hard time getting rid of it:

**app.jsx:11)

 const fetcher = (async () => {

  "@babel/cli": "^7.4.4",
   "@babel/core": "^7.4.4",
   "@babel/preset-env": "^7.4.4",
   "@babel/preset-react": "^7.0.0",
   "@types/react": "^16.8.17",
   "babel-preset-env": "^1.7.0"

here is the .babelrc

{
    "presets": [
        [
            "@babel/preset-env",
            {
                "targets": {
                    "chrome": ">70",
                },
                "exclude": ["transform-regenerator"]
            },
            "@babel/preset-react"
        ]
    ]
}
@babel-bot

This comment has been minimized.

Copy link
Collaborator

commented May 13, 2019

Hey @DrYSG! 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

This comment has been minimized.

Copy link
Member

commented May 13, 2019

What is the compiled output? Is there any other Babel configuration in your project?

PS. You don't need babel-preset-env if you are already using @babel/preset-env

@DrYSG

This comment has been minimized.

Copy link
Author

commented May 13, 2019

The bundler is parcel, and their are just 3 small JSX files and an main.html

I removed the babel-preset-env,

There are not other babel configurations.

I can provide the source also if that helps (I am just beginning to explore this)

The bundle below does have the transform-runtime plugin. And yes, it does work with that in it. I was really trying to see if I could avoid it:

{
    "presets": [
        [
            "@babel/preset-env",
            {
                "targets": {
                    "chrome": ">74",
                },
                "exclude": ["transform-regenerator"]
            },
            "@babel/preset-react"
        ]
    ],
    "plugins": [
        ["@babel/transform-runtime"]
    ]
}

dist.zip

@DrYSG

This comment has been minimized.

Copy link
Author

commented May 14, 2019

And attached is the bundle when I remove the @babel/transform-runtime plugin

dist.zip

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

commented May 14, 2019

Could you share a repository which I can use to reproduce the problem? It's impossible to debug it from the minified output.

@DrYSG

This comment has been minimized.

Copy link
Author

commented May 15, 2019

Sure, included is the source. you first request was for the compiled output. That is the only reason I sent that. We use parcel as our bundler (it finds the .babelrc)

bug.zip

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

commented May 15, 2019

It's a bug with Parcel, which for some reason tries to parse your .babelrc file and use it to generate a new config to pass to Babel.

Can you check if this works for you? (I downloaded your zip and it seems to work)

{
    "presets": [
        [
            "@babel/preset-env",
            {
                "targets": {
                    "chrome": 74,
                }
            }
        ],
        
        "@babel/preset-react"
    ]
}

Ref: parcel-bundler/parcel#1762 (comment)

@DrYSG

This comment has been minimized.

Copy link
Author

commented May 16, 2019

That also gives the regenerator bug. But as you say, it seems to be a parcel issue, not a babel issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.