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

window is not defined #23

Open
AbrarJahin opened this issue Jan 4, 2017 · 1 comment
Open

window is not defined #23

AbrarJahin opened this issue Jan 4, 2017 · 1 comment

Comments

@AbrarJahin
Copy link

Installed product versions

  • Visual Studio: 2015 community
  • This extension: 1.1.21

Description

I am a trying to use this template and tried to upgrade it to 2.4, but there is some difficulties, so I decided to use Angular 2.1.0. The styling was not working, so I have added this-

AbrarJahin/Dot.NetCore_Angular2_App@be93036

Now I am having some error like this-

An unhandled exception occurred while processing the request.

Exception: Call to Node module failed with error: Prerendering failed because of error: ReferenceError: window is not defined
at D:\Dot.NetCore_Angular2_App\ProfileManagement\ClientApp\dist\main-server.js:1:6541
at D:\Dot.NetCore_Angular2_App\ProfileManagement\ClientApp\dist\main-server.js:1:6473
at e.exports (D:\Dot.NetCore_Angular2_App\ProfileManagement\ClientApp\dist\main-server.js:1:6759)
at Object.<anonymous> (D:\Dot.NetCore_Angular2_App\ProfileManagement\ClientApp\dist\main-server.js:1:3513)
at t (D:\Dot.NetCore_Angular2_App\ProfileManagement\ClientApp\dist\main-server.js:1:217)
at Object.<anonymous> (D:\Dot.NetCore_Angular2_App\ProfileManagement\ClientApp\dist\main-server.js:1:3381)
at t (D:\Dot.NetCore_Angular2_App\ProfileManagement\ClientApp\dist\main-server.js:1:217)
at Object.e.exports (D:\Dot.NetCore_Angular2_App\ProfileManagement\ClientApp\dist\main-server.js:1:2992)
at t (D:\Dot.NetCore_Angular2_App\ProfileManagement\ClientApp\dist\main-server.js:1:217)
at Object.<anonymous> (D:\Dot.NetCore_Angular2_App\ProfileManagement\ClientApp\dist\main-server.js:1:1615)
at t (D:\Dot.NetCore_Angular2_App\ProfileManagement\ClientApp\dist\main-server.js:1:217)
at Object.<anonymous> (D:\Dot.NetCore_Angular2_App\ProfileManagement\ClientApp\dist\main-server.js:1:779)
at t (D:\Dot.NetCore_Angular2_App\ProfileManagement\ClientApp\dist\main-server.js:1:217)
at Zone.current.fork.name (D:\Dot.NetCore_Angular2_App\ProfileManagement\ClientApp\dist\main-server.js:1:310)
at Object.<anonymous> (D:\Dot.NetCore_Angular2_App\ProfileManagement\ClientApp\dist\main-server.js:1:315)
Current directory is: D:\Dot.NetCore_Angular2_App\ProfileManagement	

Steps to recreate

https://github.com/abrarjahin/Dot.NetCore_Angular2_App/commits/master

Current behavior

Explain what it's doing and why it's wrong

Expected behavior

Should run and should not give error window is not defined

@SteveSandersonMS
Copy link
Contributor

If you need to use libraries that depend on browser APIs, then you won't be able to use server-side prerendering, or at least you need to ensure that those code paths don't get hit when the app is running on the server (e.g., like in this answer: #23)

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

2 participants