polyfill icon indicating copy to clipboard operation
polyfill copied to clipboard

Cannot read property 'isNaN' of undefined

Open AlikDex opened this issue 5 years ago • 5 comments

Uncaught TypeError: Cannot read property 'isNaN' of undefined

https://github.com/inexorabletash/polyfill/blob/master/polyfill.js#L565

Use babel 7.5.6 and @babel/env preset.

What's wrong?

AlikDex avatar Jul 10 '19 22:07 AlikDex

That would happen if a global self is not defined. self is always defined in Window and Worker contexts. Presumably you're trying this outside a browser?

inexorabletash avatar Jul 10 '19 22:07 inexorabletash

In the browser. The error appears after using babel. It cuts "self" in functions

AlikDex avatar Jul 11 '19 03:07 AlikDex

Best not use them together then.

On Jul 10, 2019, at 8:23 PM, AlikDex [email protected] wrote:

In the browser. The error appears after using babel. It cuts self in functions

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

inexorabletash avatar Jul 11 '19 03:07 inexorabletash

The problem was found. Babel replaces })(this); with })(void 0); Can be lead to a single standard of function? Everywhere put })(self); (processed correctly)

AlikDex avatar Jul 11 '19 04:07 AlikDex

Babel replaces })(this); with })(void 0);

This is probably related to "use strict";. ref https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode#Securing_JavaScript

Mouvedia avatar Jul 11 '19 06:07 Mouvedia