-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Polyfill esnext.async-iterator causes "Cannot read properties of undefined (reading 'prototype')" error #1309
Comments
What |
Note that the line numbers in the stack are not actual and in this file (and in this function) is only one place where we access module.exports = function (nextHandler, IS_ITERATOR) {
var AsyncIteratorProxy = function AsyncIterator(record, state) {
// ...
};
AsyncIteratorProxy.prototype = IS_ITERATOR ? WrapForValidAsyncIteratorPrototype : AsyncIteratorHelperPrototype;
return AsyncIteratorProxy;
}; |
Yes, let me create a reproducible example later. It is reproducible from my side. |
As you can see in the code above, the problem is missing in the actual (3.33.3) version. It seems that in this old (3.8) version was an implicit undeclared dependency of |
But in the 3.33 version, I can see from the log esnext.async-iterator.* is not polyfilled into the , I think that is the reason 3.33 works. |
I'm not sure that I understood you. They should be injected in case of
The actual |
In case they are just missed on |
Thanks for the reply. Yes, you were right, with 3.33, they are injected and the bundled file works fine!
Thanks again. |
BTW, I will raise an issue to https://babeljs.io/docs/babel-preset-env#corejs too, because it says, "use corejs: { version: "3.8", proposals: true }. " It should emphasize setting the version to the actual core-js version. |
May I ask another question? What do these I find even with the recent Chome version 114, they are still polyfill. But I find without these polyfill functions my code work just fine.
|
Those features are still missed in any engines, see https://github.com/tc39/proposal-async-iterator-helpers Most likely, you do not use them and use just import foo from './foo.js';
console.log(...foo.map(it => it ** 2)); // => what is it - Array#map, Iterator#map, AsyncIterator#map, something else? I don't recommend to use |
My Babel
Then from log, I saw
This polyfilled file cause the error Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')
Only after I set
"proposals": false
and poyfill without async-iterator the code works, but why?I feel this may be a bug for async-iterator implementation.
The text was updated successfully, but these errors were encountered: