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
when @babel/polyfill is used with webpack 5 it throws a ReferenceError: global is not defined #9232
when @babel/polyfill is used with webpack 5 it throws a ReferenceError: global is not defined #9232
Comments
Hey @capaj! 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 |
I think that this has something to do with the fact that webpack 5 doesn't polyfill any node feature (i.e. |
Does webpack/webpack#8537 (comment) work for you? |
@nicolo-ribaudo just tested adding: module.exports = {
node: {
global: true
}, and yeah that works nicely. I'd still be interested to know why babel polyfill relies on the global in the first place? Wouldn't it be nicer to first check if there's a |
Yeah, or we could just use the |
The documentation recommends using We should still fix |
Makes the JavaScript bundles a tiny bit smaller. (Requires the useBuiltIns option of @babel/preset-env due to babel/babel#9232.) Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Bug Report
Current Behavior
on startup, I get the ReferenceError
Expected behavior/code
no ReferenceError is thrown
Environment
no
loader
]I understand that I probably should just provide a
global
and that could mitigate the startup issue, but I also wanted to ask why?Isn't babel polyfill primarily targeted at old browsers? Why is it that it relies on
global
to bootstrap itself when it's obviously not going to be there? Unless using webpack 1-4 obviously....The text was updated successfully, but these errors were encountered: