Open fabienne-m opened 2 years ago
@fabienne-m any progress on this?
Unfortunately, not that I know of.
my observation is that inputmask is being built and placed in the main.js bundle. Because its code referes self/window it doesnt pass over the :SSR compiler. Neither route i'm using inputmask needs to be served over SSR so i'm trying to find a way by pass this code check that stops when self/window happens. Something like configuring the routes that will be served as SSR on the server.ts
Summary
When using Inputmask with Angular Universal in ServerSideRendering mode, get a "ReferenceError: window is not defined" upon startup.
Setup
Using the
ngneat/input-mask
wrapper aroundInputmask
.Relevant libraries and versions:
Deployed to AWS Elasticbeanstalk running Node.js 16.
Reproducible locally using the Angular Universal test SSR.
Expected
When using in a client side rendering mode, no errors are shown. It would be expected that the same would happen in a SSR environment (Node.js) however the server fails to start.
Actual
Server side code fails to start, throwing a
ReferenceError: window is not defined
. I suspect this is because of the outputted webpack code (see below).Other
Relevant code from
dist/inputmask.js
: