RobinHerbots / Inputmask

Input Mask plugin
https://robinherbots.github.io/Inputmask/
MIT License
6.41k stars 2.16k forks source link

customElements is not defined #2298

Open sibelius opened 4 years ago

sibelius commented 4 years ago

After upgrading jest, I've got this error below, customElements is not defined

is there a way to polyfill this? or just avoiding breaking?

ReferenceError: customElements is not defined
    at Object.modules (/home/circleci/app/node_modules/inputmask/dist/inputmask.js:2701:13)
    at __webpack_require__ (/home/circleci/app/node_modules/inputmask/dist/inputmask.js:2743:34)
    at Object.modules (/home/circleci/app/node_modules/inputmask/dist/inputmask.js:641:81)
    at __webpack_require__ (/home/circleci/app/node_modules/inputmask/dist/inputmask.js:2743:34)
    at /home/circleci/app/node_modules/inputmask/dist/inputmask.js:2735:36
    at webpackUniversalModuleDefinition (/home/circleci/app/node_modules/inputmask/dist/inputmask.js:9:83)
    at Object.<anonymous> (/home/circleci/app/node_modules/inputmask/dist/inputmask.js:13:2)
    at Runtime._execModule (/home/circleci/app/node_modules/jest-runtime/build/index.js:1056:24)
    at Runtime._loadModule (/home/circleci/app/node_modules/jest-runtime/build/index.js:684:12)
    at Runtime.requireModule (/home/circleci/app/node_modules/jest-runtime/build/index.js:542:10)
    at Runtime.requireModuleOrMock (/home/circleci/app/node_modules/jest-runtime/build/index.js:705:21)
    at Object.<anonymous> (/home/circleci/app/node_modules/inputmask/index.js:1:45)
    at Runtime._execModule (/home/circleci/app/node_modules/jest-runtime/build/index.js:1056:24)
    at Runtime._loadModule (/home/circleci/app/node_modules/jest-runtime/build/index.js:684:12)
    at Runtime.requireModule (/home/circleci/app/node_modules/jest-runtime/build/index.js:542:10)
    at Runtime.requireModuleOrMock (/home/circleci/app/node_modules/jest-runtime/build/index.js:705:21)
RobinHerbots commented 4 years ago

@sibelius,

To chich version did you upgrade?

sibelius commented 4 years ago

image

25.1.0 -> 25.2.6

I'm getting this error in production as well, maybe some older browsers

RobinHerbots commented 4 years ago

@sibelius ,

I mean which version of inputmask.

I will push a new version to npm.

sibelius commented 4 years ago

inputmask@5.0.3

RobinHerbots commented 4 years ago

ach you will need the latest beta to fix this

sibelius commented 4 years ago

5.0.4?

I'm checking master code, this line:

https://github.com/RobinHerbots/Inputmask/blob/2b30e91028110e08ed0f6da6540e66804cd1af8b/lib/inputmaskElement.js#L8

does this check is enough for custom elements?

RobinHerbots commented 4 years ago

yes, propbaly

RobinHerbots commented 4 years ago

maybe also add the customElements check if that is needed (can you give feedback)

 if (document && document.head && document.head.attachShadow && customElements && customElements.get("input-mask") === undefined) { 
sibelius commented 4 years ago

any timeline to release the beta version?

RobinHerbots commented 4 years ago

To a stable release or a new beta in npm with the changes?

I can push a new beta to npm now.

sibelius commented 4 years ago

for a stable one

RobinHerbots commented 4 years ago

Not really an idea. Asap :-)

RobinHerbots commented 4 years ago

Use version inputmask@5.0.4-beta.33

Version 5.0.4 only contains bugfixes on top of 5.0.3

sibelius commented 4 years ago

anything missing? more automated tests?

sibelius commented 4 years ago

not failing anymore on jest

gonna check in production

thanks

onoranzefunebricloud commented 4 years ago

It's still failing for me @sibelius 🤔

"inputmask": "^5.0.4-beta.33",

Screenshot 2020-04-22 at 06 29 26

RobinHerbots commented 4 years ago

@onoranzefunebricloud,

I added an extra check for customelements. Can you have a try with beta 36