website
website copied to clipboard
[Bug]: Repl fails with `.method must be a string (While processing: "base$1")`
💻
- [ ] 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
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.
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.
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.
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 🤷♂️

Ah I mean the preset-env
tab on the sidebar, it seems that you have already enabled it so it should be all good.
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.
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?
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?