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
Babel 7 present env using useBuiltIns: usage does not transpile AMD 'define' properly #8887
Comments
Hey @chaoyzeng! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
The |
Is there an existing feature request for supporting AMD? |
Not that I know of. Generally AMD ends up getting treated as a bit of a second-class citizen compared to CommonJS and ESM. AMD is a much more limited format, and is harder to manipulate in transforms because it has so many pieces that have to work together. |
Is there any way to make this work? |
Even if Babel properly injected AMD dependencies for polyfills, Unfortunately, you have to either load |
Bug Report
Current Behavior
Using babel 7 with present env with configuration "useBuiltIns: usage" then any amd modules that contain an instance method that needs to be polyfilled will not transpile correctly.
Modules that do NOT contain instance methods will transpile correctly.
When executing the broken module you will get:
Uncaught ReferenceError: define is not defined
Input Code
I have set up a dummy project with minimum configuration to demonstrate the bug:
https://github.com/chaoyzeng/babel-7-present-env-bug
just run the webpack dev server and load the webpage to see the console error.
Expected behavior/code
All amd modules are treated the same regardless of the code that they contain.
The text was updated successfully, but these errors were encountered: