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

Error in Angular Universal with ngx-mask #399

Closed
izmaylovdev opened this issue Apr 3, 2019 · 6 comments · Fixed by #424
Closed

Error in Angular Universal with ngx-mask #399

izmaylovdev opened this issue Apr 3, 2019 · 6 comments · Fixed by #424

Comments

@izmaylovdev
Copy link

SSR broke after adding ngx-mask, error:

ReferenceError: KeyboardEvent is not defined
    at eval (webpack:///./node_modules/ngx-mask/fesm5/ngx-mask.js?:1027:88)
    at eval (webpack:///./node_modules/ngx-mask/fesm5/ngx-mask.js?:1075:2)
    at Object../node_modules/ngx-mask/fesm5/ngx-mask.js 

Version 7.8.9

@DBaker85
Copy link

DBaker85 commented Apr 4, 2019

I also have this problem. Adding NGX-mask breaks our whole solution

Description: An unhandled exception occurred. 

Exception Details: 
KeyboardEvent is not defined
ReferenceError: KeyboardEvent is not defined
   at ***\server.bundle.js:199960:88
   at Module.extendStatics (***\server.bundle.js:200008:2)
   at __webpack_require__ (***\server.bundle.js:20:30)
   at Object.ngx-mask (***\server.bundle.js:126715:18)
...

@bpop-bc
Copy link

bpop-bc commented Apr 4, 2019

The problem comes from the fact that there is no implementation of the KeyboardEvent on the server. There is issue about the same problem regarding ngx-bootstrap. Assigning the event to any does the job but I'm not sure that this is the right solution.

@rms-bc
Copy link

rms-bc commented Apr 10, 2019

Hi, I am also facing this issue, and it will prevent me from using this lib, unfortunately :/
Do you have an ETA on this fix?

Thanks for the great work!

@ValeriaKochegarova ValeriaKochegarova removed their assignment Apr 11, 2019
bpopnikolov added a commit to bpopnikolov/ngx-mask that referenced this issue Apr 11, 2019
in order to avoid server errors we have to patch the global object with
fake implementation of the KeyboardEvent and add a type alias so that
the global object path is executed right before the event reference in the code

fixes JsDaddy#399
@bpopnikolov
Copy link
Contributor

Hello are there any plans to merge #424? Seems like there are people who already tried this in prod and it works for them as well. This is the only solution I could come up with other than replacing the type of the event with any or messing up with the webpack's config.

@NepipenkoIgor
Copy link
Collaborator

@bpopnikolov Hi. I will check . I will able to do this today or tomorrow

NepipenkoIgor pushed a commit that referenced this issue Apr 23, 2019
)

in order to avoid server errors we have to patch the global object with
fake implementation of the KeyboardEvent and add a type alias so that
the global object path is executed right before the event reference in the code

fixes #399
close #399
@NepipenkoIgor
Copy link
Collaborator

@izmaylovdev @DBaker85 @bpop-bc @rms-bc @bpopnikolov Pleas try latest version

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

Successfully merging a pull request may close this issue.

7 participants