-
Notifications
You must be signed in to change notification settings - Fork 482
Lazy Loading - System is not defined. #741
Comments
+1 |
I am having exactly the same issue. I tried using different webpack loaders, eg. angular-router-loader, but no help. Module is loaded in to the browser, but is not rendered with universal and error in the console is same as @seklyza 's. Only difference is Linux OS.... |
+1 |
Same issue when using angular-cli and the content is not rendered on the server so I assume that's because of this error. |
But I have just found on the angular-cli pages that
|
I got it to work in my starter repo here: https://github.com/patrickmichalina/fusebox-angular-universal-starter |
@patrickmichalina Any idea what you did to make it work? |
@dottodot a small and naive plugin that replaces the route during bundling. |
Will be solved by using https://github.com/angular/universal/tree/master/modules/ng-module-map-ngfactory-loader when it's published |
@Toxicable Is there a timeline for publishing? Also is this the planned patch for CLI integration, or do they have their own fix in mind? cc @gdi2290 @hansl |
@CaerusKaru there are many ways to solve this. One as you mentioned is replacing NgModuleFactoryLoader but if you're using webpack you can simply include angular into your webpack bundle which allows webpack to replace the for publishing |
Let's hope it will get to the CLI as fast as possible. SSR and Lazy Loading are both great features of Angular but they don't work "natively" together. |
@seklyza I don't know what you're talking about when you say "natively" none of this stuff is native at all. |
can be closed since |
@gdi2290 , you said "if you're using webpack you can simply include angular into your webpack bundle".
|
Please use @nguniversal/module-map-ngfactory-loader for this - https://github.com/angular/universal/tree/master/modules/module-map-ngfactory-loader |
@vikerman after using this solution i have got can you help me? |
@Sacred90 did you add in |
@Toxicable i'm not sure where i have to add this. For adding universal via angular CLI i'm using this article -> Angular Server-side rendering by using Angular-CLI and i suppose I have to add it here
for any help i will be really appreciate |
|
@Toxicable Where do I import |
@nicky-lenaers --> |
@Toxicable Sorry for that - but using https://github.com/angular/universal/tree/master/modules/module-map-ngfactory-loader still rise the same system is not define d error - any ideas why it could be? Angular version: 4.3.5
LAZY_MODULE_MAP - initialized with array of strings but app.engine('html', ngExpressEngine({ seems not working |
@vlad-ovsyannikov it works fine for me, did you also import |
I had this problem when using |
Hey. |
I had this same error, but it was because I was importing the same provider in my app.browser.module and app.module (oops). Maybe that will help someone else not waste as much time as I did |
@yosigolan's answer worked for me as well. Cheers! |
I see the disconnect. In my starter, I use Fusebox bundler, which I have configured such that server side code is all one single bundle. Only client side code is code-splitted. So this is actually not required for my setup, but I can see how it is needed. |
I had this same issue. In my case, any of above solutions not works. I found the cause from Also, directly import RouterModule in AppModule seems not properly work even if it have no error message in ssr request. Here is my implementation case.
You must re-export RouterModule like this.
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Note: for support questions, please use one of these channels: https://github.com/angular/universal/blob/master/CONTRIBUTING.md#question. This repository's issues are reserved for feature requests and bug reports. Also, Preboot has moved to https://github.com/angular/preboot - please make preboot-related issues there.
Report a bug
I have a Universal Angular server, with lazy routes. Whenever I go to a lazy route and refresh, I get an error on the server "System is not defined". (The lazy route is seen in the browser, however it is not universally loaded)
Set up a Universal Server, have a lazy route, enter the route, reload and see the errror on the server.
GitHub repo
To "universally" lazy-load the route without having console errors.
I need to support server-side rendering with lazy routes.
Error:
Stackoverflow issue
NOTE: I am not using SystemJS at all.
The text was updated successfully, but these errors were encountered: