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]: Repl fails with .method must be a string (While processing: "base$1") #2595

Open
1 task
danieltroger opened this issue Nov 10, 2021 · 8 comments
Open
1 task
Labels

Comments

@danieltroger
Copy link

💻

  • Would you like to work on a fix?

How are you using Babel?

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

Input code

https://babeljs.io/repl/#?browsers=ie%2011&build=&builtIns=false&corejs=3.6&spec=false&loose=false&code_lz=LYQwlgdgFAlA3AKAGYCZaIDYFMAuACMPAXjwAZEQBnATwgGM8kBXenMAewj1EljwG8EePHU6V22AHQZ2AcygAiABZgF8IXhAB3cPm268EJhgyJhoiOKkz5YdQF8ECKrQbNWHLqj6Dh-sPhGJmaaOgGGxqYaYADUMYiOQA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env%2Creact%2Cstage-2&prettier=false&targets=&version=7.16.3&externalPlugins=%40babel%2Fplugin-transform-regenerator%407.16.0%2Cbabel-plugin-polyfill-regenerator%400.2.3&assumptions=%7B%7D

I added "babel-plugin-polyfill-regenerator" and now it says [BABEL] /repl.jsx: .method must be a string (While processing: "base$1")

Configuration file name

No response

Configuration

REPL issue

Current and expected behavior

Current behavior: [BABEL] /repl.jsx: .method must be a string (While processing: "base$1")

Expected behavior: Either a readable error message indicating what I did wrong, if I did something wrong, or some output code.

Environment

Not applicable

Possible solution

No response

Additional context

No response

@babel-bot
Copy link
Contributor

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

@JLHwung
Copy link
Contributor

JLHwung commented Nov 10, 2021

The REPL currently does not support plugin with required options. In this case, the plugin-polyfill-regenerator requires a method: "usage-global" | "usage-pure" | "entry-global" option. As a workaround you can use preset-env, which uses plugin-polyfill-regenerator under the hood.

I will move this issue to the website repo.

@babel-bot
Copy link
Contributor

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

@JLHwung JLHwung transferred this issue from babel/babel Nov 10, 2021
@JLHwung JLHwung added the repl label Nov 10, 2021
@danieltroger
Copy link
Author

As a workaround you can use preset-env, which uses plugin-polyfill-regenerator under the hood.

Yeah, I tried that. But I'm too stupid because I don't understand how to add it 🤷‍♂️

Screenshot 2021-11-10 at 15 39 23

@JLHwung
Copy link
Contributor

JLHwung commented Nov 10, 2021

Ah I mean the preset-env tab on the sidebar, it seems that you have already enabled it so it should be all good.

image

@danieltroger
Copy link
Author

Ah.

Why does the code print this when executed then? Uncaught ReferenceError: regeneratorRuntime is not defined

This with "env preset enabled" checked does not contain regeneratorRuntime.

@JLHwung
Copy link
Contributor

JLHwung commented Nov 10, 2021

Uncaught ReferenceError: regeneratorRuntime is not defined

Because we don't have regenerator runtime in the browsers. The execute toggle runs the transpiled code, unfortunately, without polyfills. Would you mind open a new issue against that?

@danieltroger
Copy link
Author

Because we don't have regenerator runtime in the browsers. The execute toggle runs the transpiled code, unfortunately, without polyfills. Would you mind open a new issue against that?

Oh, I didn't notice the evaluate toggle.
Actually it does work, because the REPL itself contains regeneratorRuntime.

But IMO the output code of the REPL should be the same as of babel on the CLI.
I pasted it into another tab and got the error there.

Should I still open an issue?

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

No branches or pull requests

3 participants