Angular-cli: SSR with lazy loading does not load Service Modules

Created on 12 Jan 2019  Â·  6Comments  Â·  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [ x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [x ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

$ ng --version

 _                      _                 ____ _     ___
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ â–³ \ | '_ \ / _| | | | |/ _ | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ __| |_|__, |__,_|_|__,_|_| ____|_____|___|
|___/

Angular CLI: 7.2.1
Node: 8.12.0
OS: darwin x64
Angular: 6.1.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.7.5
@angular-devkit/build-angular 0.7.5
@angular-devkit/build-optimizer 0.7.5
@angular-devkit/build-webpack 0.7.5
@angular-devkit/core 0.7.5
@angular-devkit/schematics 7.2.1
@angular/cli 7.2.1
@angular/fire 5.1.1
@angular/platform-server 7.2.0
@ngtools/webpack 6.1.5
@schematics/angular 7.2.1
@schematics/update 0.12.1
rxjs 6.3.3
typescript 2.7.2
webpack 4.9.2

$ node --version
v8.12.0
$ npm --version
6.4.1

Repro steps

Steps for SSR as mentioned in https://angular.io/guide/universal at end of step 3, when we try to run

$ ng run my-project:server

It gives below error. The error is quite clear that all Service Modules are not loaded

The log given by the failure

$ ng run indusriva:server

Date: 2019-01-12T10:48:21.646Z
Hash: c332a087f784e253ebbb
Time: 9109ms
chunk {main} main.js, main.js.map (main) 3.3 kB [entry] [rendered]

ERROR in : Can't resolve all parameters for AdminBulkUploadComponent in /Users/elitemantra/Documents/EM-Projects/indusriva/hosting/src/app/admin/admin-bulk-upload/admin-bulk-upload.component.ts: (?, ?, ?, [object Object], [object Object], [object Object], [object Object]).
src/app/admin/admin-bulk-upload/admin-bulk-upload.component.ts(2,43): error TS2307: Cannot find module 'src/app/shared/service/category/category.service'.
src/app/admin/admin-bulk-upload/admin-bulk-upload.component.ts(3,41): error TS2307: Cannot find module 'src/app/shared/service/product/product.service'.
src/app/admin/admin-bulk-upload/admin-bulk-upload.component.ts(4,28): error TS2307: Cannot find module 'src/app/shared/service/url/url.service'.
src/app/admin/admin-item/admin-item.component.ts(2,29): error TS2307: Cannot find module 'src/app/shared/service/user/user.service'.
src/app/admin/admin-item/admin-item.component.ts(3,36): error TS2307: Cannot find module 'src/app/shared/service/order/order.service'.
src/app/admin/admin-order/admin-order.component.ts(2,33): error TS2307: Cannot find module 'src/app/shared/service/language/language.service'.
src/app/admin/admin-order/admin-order.component.ts(4,37): error TS2307: Cannot find module 'src/app/shared/service/router-change/router-change.service'.
src/app/admin/admin-order/admin-order.component.ts(5,43): error TS2307: Cannot find module 'src/app/shared/service/order/order.service'.
src/app/admin/admin-order/admin-order.component.ts(6,35): error TS2307: Cannot find module 'src/app/shared/service/user/user.service'.
src/app/admin/admin-product/admin-product.component.ts(13,36): error TS2307: Cannot find module 'src/app/shared/service/progressbar/progressbar.service'.
src/app/admin/admin-product-action/admin-product-action.component.ts(13,36): error TS2307: Cannot find module 'src/app/shared/service/progressbar/progressbar.service'.
src/app/admin/admin-product-action/admin-product-action.component.ts(16,51): error TS2307: Cannot find module 'src/app/shared/service/notification/notification.service'.
src/app/admin/admin-product-action/admin-product-action.module.ts(9,36): error TS2307: Cannot find module 'src/app/actions/category-tree/category-tree.module'.
src/app/admin/admin-url/admin-url.component.ts(2,33): error TS2307: Cannot find module 'src/app/shared/service/url/url.service'.
src/app/admin/admin-url/admin-url.component.ts(3,33): error TS2307: Cannot find module 'src/app/shared/service/language/language.service'.
src/app/admin/admin-url/admin-url.component.ts(5,37): error TS2307: Cannot find module 'src/app/shared/service/router-change/router-change.service'.
src/app/admin/admin-user/admin-user.component.ts(3,35): error TS2307: Cannot find module 'src/app/shared/service/user/user.service'.
src/app/admin/admin-user/admin-user.component.ts(4,35): error TS2307: Cannot find module 'src/app/shared/service/role/role.service'.
src/app/admin/admin-user/admin-user.component.ts(5,33): error TS2307: Cannot find module 'src/app/shared/service/language/language.service'.
src/app/admin/admin-user/admin-user.component.ts(7,37): error TS2307: Cannot find module 'src/app/shared/service/router-change/router-change.service'.
src/app/admin/dashboard/dashboard.component.ts(3,41): error TS2307: Cannot find module 'src/app/shared/service/product/product.service'.
src/app/admin/dashboard/dashboard.component.ts(4,43): error TS2307: Cannot find module 'src/app/shared/service/category/category.service'.
src/app/pages/checkout/checkout.component.ts(2,43): error TS2307: Cannot find module 'src/app/shared/service/order/order.service'.
src/app/pages/checkout/checkout.component.ts(3,29): error TS2307: Cannot find module 'src/environments/environment'.
src/app/pages/checkout/checkout.component.ts(4,30): error TS2307: Cannot find module 'src/app/shared/service/paytm/paytm.service'.
src/app/pages/checkout/checkout.component.ts(5,33): error TS2307: Cannot find module 'src/app/shared/service/language/language.service'.
src/app/pages/checkout/checkout.component.ts(8,35): error TS2307: Cannot find module 'src/app/shared/service/user/user.service'.
src/app/pages/checkout/checkout.component.ts(9,37): error TS2307: Cannot find module 'src/app/shared/service/router-change/router-change.service'.
src/app/pages/checkout/checkout.component.ts(10,41): error TS2307: Cannot find module 'src/app/shared/service/product/product.service'.
src/app/pages/checkout/checkout.component.ts(12,31): error TS2307: Cannot find module 'src/app/shared/service/window/window.service'.
src/app/pages/dummy-home/dummy-home.component.ts(3,29): error TS2307: Cannot find module 'src/app/shared/service/user/user.service'.
src/app/pages/home/home.component.ts(3,43): error TS2307: Cannot find module 'src/app/shared/service/category/category.service'.
src/app/pages/home/home.component.ts(4,45): error TS2307: Cannot find module 'src/app/shared/service/attribute/attribute.service'.
src/app/pages/home/home.component.ts(5,32): error TS2307: Cannot find module 'src/app/shared/service/product/product.service'.
src/app/pages/home/home.component.ts(6,29): error TS2307: Cannot find module 'src/app/shared/service/user/user.service'.
src/app/pages/home/home.component.ts(7,35): error TS2307: Cannot find module 'src/app/shared/service/role/role.service'.
src/app/pages/home/home-cat/home-cat.component.ts(2,43): error TS2307: Cannot find module 'src/app/shared/service/category/category.service'.
src/app/pages/home/home-cat/home-cat.component.ts(3,32): error TS2307: Cannot find module 'src/app/shared/service/product/product.service'.
src/app/pages/home/home.module.ts(12,34): error TS2307: Cannot find module 'src/app/shared/pipe/prod-filter/prod-filter.module'.
src/app/pages/kart/kart.component.ts(2,33): error TS2307: Cannot find module 'src/app/shared/service/language/language.service'.
src/app/pages/kart/kart.component.ts(3,35): error TS2307: Cannot find module 'src/app/shared/service/kart/kart.service'.
src/app/pages/kart/kart.component.ts(4,41): error TS2307: Cannot find module 'src/app/shared/service/product/product.service'.
src/app/pages/kart/kart.component.ts(5,31): error TS2307: Cannot find module 'src/app/shared/service/window/window.service'.
src/app/pages/kart/kart.component.ts(6,29): error TS2307: Cannot find module 'src/app/shared/service/user/user.service'.
src/app/pages/kart/kart.component.ts(7,30): error TS2307: Cannot find module 'src/app/shared/service/order/order.service'.
src/app/pages/kart/kart.component.ts(8,32): error TS2307: Cannot find module 'src/app/shared/service/voucher/voucher.service'.
src/app/pages/login/login.component.ts(10,31): error TS2307: Cannot find module 'src/app/shared/service/window/window.service'.
src/app/pages/login/login.component.ts(11,29): error TS2307: Cannot find module 'src/app/shared/service/kart/kart.service'.
src/app/pages/login/login.component.ts(12,29): error TS2307: Cannot find module 'src/app/shared/service/user/user.service'.
src/app/pages/orders/orders.component.ts(2,43): error TS2307: Cannot find module 'src/app/shared/service/order/order.service'.
src/app/pages/orders/orders.component.ts(3,41): error TS2307: Cannot find module 'src/app/shared/service/product/product.service'.
src/app/pages/orders/orders.component.ts(4,35): error TS2307: Cannot find module 'src/app/shared/service/user/user.service'.
src/app/pages/profile/profile.component.ts(9,28): error TS2307: Cannot find module 'src/app/shared/service/url/url.service'.
src/app/pages/profile/profile.component.ts(10,35): error TS2307: Cannot find module 'src/app/shared/service/user/user.service'.
src/app/pages/profile/profile.component.ts(11,31): error TS2307: Cannot find module 'src/app/shared/service/window/window.service'.
src/app/pages/redirect/redirect.component.ts(2,30): error TS2307: Cannot find module 'src/app/shared/service/order/order.service'.
src/app/pages/redirect/redirect.component.ts(3,29): error TS2307: Cannot find module 'src/environments/environment'.
src/app/pages/redirect/redirect.component.ts(4,44): error TS2307: Cannot find module 'src/app/shared/service/paytm/paytm.service'.
src/app/pages/redirect/redirect.component.ts(5,33): error TS2307: Cannot find module 'src/app/shared/service/language/language.service'.
src/app/pages/search/search.component.ts(3,41): error TS2307: Cannot find module 'src/app/shared/service/product/product.service'.
src/app/pages/signup/signup.component.ts(9,29): error TS2307: Cannot find module 'src/app/shared/service/user/user.service'.
src/app/pages/signup/signup.component.ts(10,29): error TS2307: Cannot find module 'src/app/shared/service/kart/kart.service'.
src/app/pages/url/url.component.ts(3,33): error TS2307: Cannot find module 'src/app/shared/service/url/url.service'.
src/app/pages/url/product/product.component.ts(2,41): error TS2307: Cannot find module 'src/app/shared/service/product/product.service'.
src/app/pages/url/product/product.component.ts(3,35): error TS2307: Cannot find module 'src/app/shared/service/user/user.service'.
src/app/pages/url/product/product.component.ts(4,33): error TS2307: Cannot find module 'src/app/shared/service/language/language.service'.
src/app/pages/url/product/product.component.ts(5,29): error TS2307: Cannot find module 'src/app/shared/service/kart/kart.service'.
src/app/pages/url/product/product.component.ts(6,31): error TS2307: Cannot find module 'src/app/shared/service/window/window.service'.
src/app/pages/url/category/category.component.ts(2,33): error TS2307: Cannot find module 'src/app/shared/service/category/category.service'.
src/app/pages/url/category/category.component.ts(3,41): error TS2307: Cannot find module 'src/app/shared/service/product/product.service'.
src/app/pages/url/category/category.component.ts(4,33): error TS2307: Cannot find module 'src/app/shared/service/language/language.service'.
src/app/pages/url/category/category.component.ts(6,29): error TS2307: Cannot find module 'src/app/shared/service/user/user.service'.
src/app/pages/url/category/category.component.ts(7,29): error TS2307: Cannot find module 'src/app/shared/service/kart/kart.service'.
src/app/pages/url/category/category.component.ts(8,45): error TS2307: Cannot find module 'src/app/shared/service/attribute/attribute.service'.
src/app/pages/url/seller/seller.component.ts(2,33): error TS2307: Cannot find module 'src/app/shared/service/category/category.service'.
src/app/pages/url/seller/seller.component.ts(3,41): error TS2307: Cannot find module 'src/app/shared/service/product/product.service'.
src/app/pages/url/seller/seller.component.ts(4,33): error TS2307: Cannot find module 'src/app/shared/service/language/language.service'.
src/app/pages/url/seller/seller.component.ts(5,35): error TS2307: Cannot find module 'src/app/shared/service/user/user.service'.
src/app/pages/url/seller/seller.component.ts(6,29): error TS2307: Cannot find module 'src/app/shared/service/kart/kart.service'.
src/app/pages/url/seller/seller.component.ts(7,45): error TS2307: Cannot find module 'src/app/shared/service/attribute/attribute.service'.
src/app/pages/url/shared/cat-sidebar/cat-sidebar.component.ts(2,33): error TS2307: Cannot find module 'src/app/shared/service/language/language.service'.
src/app/pages/url/shared/cat-sidebar/cat-sidebar.component.ts(3,33): error TS2307: Cannot find module 'src/app/shared/service/category/category.service'.
src/app/pages/url/shared/cat-sidebar/cat-sidebar.component.ts(4,45): error TS2307: Cannot find module 'src/app/shared/service/attribute/attribute.service'.
src/app/pages/wall/wall.component.ts(3,41): error TS2307: Cannot find module 'src/app/shared/service/product/product.service'.

Desired functionality

Should generate Universal Bundle

Mention any other details that might be useful

repro steps

Most helpful comment

@MehtaAr25 Hi, can i know did u resolve the issue? because i think i am facing same problems here.

Dear Wilson,
My issue was that my module import were starting with src/app/* but it should be the direct path for example ../service/* and should not point from src/.. please check if it is same for you

All 6 comments

This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please?

You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

This might be related to your directory structure so its really important to get an accurate repro to diagnose this.

Dive into this repo, i got it working with SSR and lazy loading: https://bitbucket.org/rickvandermey/rvdm-boilerplate-angular

Thanks for reporting this issue. However, you didn't provide sufficient information for us to understand and reproduce the problem. Please check out our submission guidelines to understand why we can't act on issues that are lacking important information.

If the problem persists, please file a new issue and ensure you provide all of the required information when filling out the issue template.

@MehtaAr25 Hi, can i know did u resolve the issue? because i think i am facing same problems here.

@MehtaAr25 Hi, can i know did u resolve the issue? because i think i am facing same problems here.

Dear Wilson,
My issue was that my module import were starting with src/app/* but it should be the direct path for example ../service/* and should not point from src/.. please check if it is same for you

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings