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
Disable Babel in the @babel/runtime package. #11047
Comments
Hey @aradzie! 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." |
I think that there is still value in transpiling it sometimes, for example to include polyfills for the functions used by the helpers. |
Looking at the plugin source code it seems like it already tries to detect the situation when the typeof helper is applied to itself. Is this the case? If so, then that code probably is not working properly and needs to be fixed instead of this issue. |
To me it seems Webpack already tries to take care of the case that another typeof function exists by reassigning it to
before using this new function to do the work. But somehow this doesn‘t get the job done: The error |
@wolf-benjamin No, please take a look at the imported module id. It is the same as the module id in which the helper function is declared. The module imports from itself! And this is the result of application of Babel to its own helper function. PS I am preparing a small project to demonstrate the bug. |
Btw, adding ignore/exclude commands for |
And here is the repository I created to demonstrate this issue -- https://github.com/aradzie/babel-typeof-bug |
@aradzie Thanks! I didn't know that we already tried to prevent this. |
@nicolo-ribaudo Unfortunately this seems to be a recurring bug. |
I'm preparing a PR |
Feature Request
Is your feature request related to a problem? Please describe.
The combination of Webpack with Babel may cause a problem such as #10996 if the
@babel/runtime
package is not explicitly excluded from Babel. This package contains helper functions which must not be transpiled by Babel. However, if care is not taken to exclude, Webpack will apply Babel to@babel/runtime
resulting in a broken bundle.For example, the Babel runtime contains helper function
_typeof(obj)
which replaces thetypeof
operator to recognizeSymbol
s. This function contains few typeof operators internally, and when transpiled by Babel these operators are replaced with the same helper function. Whoops!Describe the solution you'd like
If Babel contains any exclusion mechanism, it must be applied to package
@babel/runtime
to prevent the situations as the above.The text was updated successfully, but these errors were encountered: