You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
/*! * dist/inputmask * https://github.com/RobinHerbots/Inputmask * Copyright (c) 2010 - 2020 Robin Herbots * Licensed under the MIT license * Version: 5.0.5-beta.0 */!functionwebpackUniversalModuleDefinition(root,factory){if(true)module.exports=factory();else{vari,a;}}(window,function(){^
ReferenceError: windowisnotdefined
The text was updated successfully, but these errors were encountered:
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
:The text was updated successfully, but these errors were encountered: