Skip to content
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

ReferenceError: globalThis is not defined in old browsers #313

Closed
OliverWall opened this issue Mar 2, 2020 · 7 comments
Closed

ReferenceError: globalThis is not defined in old browsers #313

OliverWall opened this issue Mar 2, 2020 · 7 comments

Comments

@OliverWall
Copy link

Hi.
Big thanks for you libriary. It very comfortable and functionallity libriary.

Problem:
I developed react component using react-imask ^6.0.0, but i found a bug in production of several users who use old browser.

Example

Workspace:
mozilla 58.0 or other old browser
test application for you

Run app in firefox.

ErrorMessage: ReferenceError: globalThis is not defined

What can i do? I have several users in production and they get this error, because of this I can't use your library =(

Will Its possible fix in next release?

@stijnbollen
Copy link

stijnbollen commented Mar 2, 2020

I recently updated my imask library from 6.0.1 to 6.0.3 and ran into the same problem.
Clients using old browsers and IE will get the same reference error.

this isn't a new issue: #296

@OliverWall
Copy link
Author

Do I understand correctly that globalThis will be removed in the next release 6.0.4?

@uNmAnNeR
Copy link
Owner

uNmAnNeR commented Mar 3, 2020

Hello guys! Thanks for using imask and helping to improve it.

Since 6.0.0 only umd build contains polyfills. If you are using bundlers then probably you are using es build. So you have to include polyfills manually according to environment you want to support.
List of all polyfills to support down to ie 11 is here: https://github.com/uNmAnNeR/imaskjs/blob/master/packages/imask/src/polyfills.js
As you can see, there are some more options except globalThis.

Here is interersting discussion about polyfilling: w3ctag/polyfills#6 (comment)

@OliverWall no, globalThis will be here
@stijnbollen #296 is little bit different but directed me to exclude globalThis along side with other polyfills.

Please don't close this issue until it will be in a guide. I can't get why this still is not described. Really sorry about that.

@OliverWall
Copy link
Author

Thanks for answer.

I will wait for help or the guide from you. Right now i use react-imask v.6.0.3 and still get error in this compoent. I installed package from NPM.

@uNmAnNeR
Copy link
Owner

uNmAnNeR commented Mar 3, 2020

@OliverWall
the solution is pretty simple:

If you need only globalThis polyfill, then also this one could be used: https://github.com/ungap/global-this/

polyfills should be imported before imask

@OliverWall
Copy link
Author

OliverWall commented Mar 3, 2020

@uNmAnNeR

Thank you very much for help and this beautiful library!

@uNmAnNeR
Copy link
Owner

fixed in #331

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants