Title: ng build AOT + lazy loading from different package · Issue #5986 · angular/angular-cli · GitHub
Open Graph Title: ng build AOT + lazy loading from different package · Issue #5986 · angular/angular-cli
X Title: ng build AOT + lazy loading from different package · Issue #5986 · angular/angular-cli
Description: Bug Report or Feature Request (mark with an x) - [x ] bug report -> please search issues before submitting - [x ] feature request Versions. Windows 7 and MacOS $ ng --version @angular/cli: 1.0.0 node: 7.7.2 os: win32 x64 @angular/common:...
Open Graph Description: Bug Report or Feature Request (mark with an x) - [x ] bug report -> please search issues before submitting - [x ] feature request Versions. Windows 7 and MacOS $ ng --version @angular/cli: 1.0.0 no...
X Description: Bug Report or Feature Request (mark with an x) - [x ] bug report -> please search issues before submitting - [x ] feature request Versions. Windows 7 and MacOS $ ng --version @angular/cli: 1.0.0...
Opengraph URL: https://github.com/angular/angular-cli/issues/5986
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ng build AOT + lazy loading from different package","articleBody":"\u003c!--\r\nIF YOU DON'T FILL OUT THE FOLLOWING INFORMATION YOUR ISSUE MIGHT BE CLOSED WITHOUT INVESTIGATING\r\n-->\r\n### Bug Report or Feature Request (mark with an `x`)\r\n```\r\n- [x ] bug report -> please search issues before submitting\r\n- [x ] feature request\r\n```\r\n\r\n### Versions.\r\n\u003c!--\r\nOutput from: `ng --version`.\r\nIf nothing, output from: `node --version` and `npm --version`.\r\n Windows (7/8/10). Linux (incl. distribution). macOS (El Capitan? Sierra?)\r\n-->\r\nWindows 7 and MacOS\r\n$ ng --version\r\n@angular/cli: 1.0.0\r\nnode: 7.7.2\r\nos: win32 x64\r\n@angular/common: 4.0.2\r\n@angular/compiler: 4.0.2\r\n@angular/core: 4.0.2\r\n@angular/forms: 4.0.2\r\n@angular/http: 4.0.2\r\n@angular/platform-browser: 4.0.2\r\n@angular/platform-browser-dynamic: 4.0.2\r\n@angular/router: 4.0.2\r\n@angular/cli: 1.0.0\r\n@angular/compiler-cli: 4.0.2\r\n\r\n### Repro steps.\r\n\u003c!--\r\nSimple steps to reproduce this bug.\r\nPlease include: commands run, packages added, related code changes.\r\nA link to a sample repo would help too.\r\n-->\r\n\r\nStack Overflow Question:\r\nhttp://stackoverflow.com/questions/43441732/angular-2-error-when-ng-build-aot-lazy-loading-from-different-package\r\n\r\nSample Repo:\r\nhttps://github.com/chorew/AngularSample\r\n\r\nRunning the app\r\n\r\n1. clone the repo\r\n2. npm install\r\n3. npm run dev:library\r\n\r\nconst routes: Routes = [\r\n **{ path: 'library', loadChildren: '@myapp/library/src/index#ModuleAModule' }** // lazy loading a module from a different package\r\n];\r\n\r\n### The log given by the failure.\r\n\u003c!-- Normally this include a stack trace and some more information. -->\r\n```\r\nmain.app@0.0.0 build C:\\Users\\Juan.Pablo\\projects\\POC\\AngularSample\\packages\\main.app\r\n> ng build --aot\r\n\r\nHash: dfaf89ef3b1bb2e81c75\r\nTime: 6307ms\r\nchunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 158 kB {4} [initial] [rendered]\r\nchunk {1} main.bundle.js, main.bundle.js.map (main) 28.3 kB {3} [initial] [rendered]\r\nchunk {2} styles.bundle.js, styles.bundle.js.map (styles) 9.77 kB {4} [initial] [rendered]\r\nchunk {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 1.37 MB [initial] [rendered]\r\nchunk {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]\r\n\r\nERROR in ./src/$$_gendir async\r\nModule not found: Error: Can't resolve 'C:\\Users\\Juan.Pablo\\projects\\POC\\AngularSample\\packages\\main.app\\src\\node_modules\\@myapp\\library\\src\\index.\r\nd.ngfactory.ts' in 'C:\\Users\\Juan.Pablo\\projects\\POC\\AngularSample\\packages\\main.app\\src\\$$_gendir'\r\n @ ./src/$$_gendir async\r\n @ ./~/@angular/core/@angular/core.es5.js\r\n @ ./src/main.ts\r\n @ multi ./src/main.ts\r\n\r\n```\r\n\r\nNotice how it is trying to find the lazy loaded module inside the `main.app\\src` folder\r\n\r\n\r\nApp src path\r\nC:\\Users\\Juan.Pablo\\projects\\POC\\AngularSample\\packages\\main.app\\src\\ \r\n\r\nLazy loaded from package\r\n@myapp\\library\\src\\index.d.ngfactory.ts\r\n```\r\n\r\n### Desired functionality.\r\n\u003c!--\r\nWhat would like to see implemented?\r\nWhat is the usecase?\r\n-->\r\n\r\nThis is a sample app with 2 sub-packages.\r\n\r\npackages/main.app\r\npackages/library\r\nthe goal is to have a library package with different modules of the app \r\nand have some specific modules lazy loaded.\r\n\r\nThe use case is to be able to load modules from different packages/repos developed by different teams and pull just the needed packages from npm to configure the routes.\r\n\r\nconst routes: Routes = [\r\n { path: 'library', loadChildren: '@myapp/library/src/index#ModuleAModule' }, // developed by Team A\r\n { path: 'anotherLibrary', loadChildren: '@myapp/anotherLibrary/src/index#ModuleAModule' } // developed by Team B\r\n];\r\n\r\nand so on.\r\n\r\n### Mention any other details that might be useful.\r\n\u003c!-- Please include a link to the repo if this is related to an OSS project. -->\r\n\r\nMain.app was generated with ng cli\r\nLibrary package is custom project using ngc and gulp\r\n","author":{"url":"https://github.com/jpguevara","@type":"Person","name":"jpguevara"},"datePublished":"2017-04-17T14:06:24Z","url":"https://github.com/angular/angular-cli/issues/5986"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a9e5397e-20e1-6119-37f9-9de8c7c715e4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B0D8:23CF06:14D6F3A:1AAF1AD:6B011C8D |
| html-safe-nonce | 967e92527f8477d33d32dd5a7571d8270e6ee78e0fd9c2855608d08e793f8898 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMEQ4OjIzQ0YwNjoxNEQ2RjNBOjFBQUYxQUQ6NkIwMTFDOEQiLCJ2aXNpdG9yX2lkIjoiMzgxMTU3MDA4NTg0MDEwMDQ5MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f8c1d32a7bbf21e8b1af5211eaa643ce7b816a9b06c7f302035666aaf7ac5821 |
| hovercard-subject-tag | issue:222139017 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/5986/issue_layout |
| twitter:image | https://opengraph.githubassets.com/963bfeae507d70f0e20dc6a572d735689cc2619142bf6fbfca22dd4047f526d8/angular/angular-cli/issues/5986 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/963bfeae507d70f0e20dc6a572d735689cc2619142bf6fbfca22dd4047f526d8/angular/angular-cli/issues/5986 |
| og:image:alt | Bug Report or Feature Request (mark with an x) - [x ] bug report -> please search issues before submitting - [x ] feature request Versions. Windows 7 and MacOS $ ng --version @angular/cli: 1.0.0 no... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jpguevara |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width