Title: [@ngtools/webpack] Webpack cannot distinguish on context and would fail to load the proper one. · Issue #10128 · angular/angular-cli · GitHub
Open Graph Title: [@ngtools/webpack] Webpack cannot distinguish on context and would fail to load the proper one. · Issue #10128 · angular/angular-cli
X Title: [@ngtools/webpack] Webpack cannot distinguish on context and would fail to load the proper one. · Issue #10128 · angular/angular-cli
Description: Versions node: v8.11.0 npm: 5.7.1 Windows 10 "@angular/animations": "5.2.9", "@angular/cdk": "5.2.4", "@angular/common": "5.2.9", "@angular/compiler": "5.2.9", "@angular/core": "5.2.9", "@angular/forms": "5.2.9", "@angular/http": "5.2.9"...
Open Graph Description: Versions node: v8.11.0 npm: 5.7.1 Windows 10 "@angular/animations": "5.2.9", "@angular/cdk": "5.2.4", "@angular/common": "5.2.9", "@angular/compiler": "5.2.9", "@angular/core": "5.2.9", "@angular/f...
X Description: Versions node: v8.11.0 npm: 5.7.1 Windows 10 "@angular/animations": "5.2.9", "@angular/cdk": "5.2.4", "@angular/common": "5.2.9", "@...
Opengraph URL: https://github.com/angular/angular-cli/issues/10128
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[@ngtools/webpack] Webpack cannot distinguish on context and would fail to load the proper one.","articleBody":"\u003c!--\r\nWe will close this issue if you don't provide the needed information.\r\nFor feature requests, delete the form below and describe the requirements and use case.\r\n-->\r\n\r\n### Versions\r\n```\r\nnode: v8.11.0\r\nnpm: 5.7.1\r\nWindows 10\r\n```\r\n```\r\n\"@angular/animations\": \"5.2.9\",\r\n\"@angular/cdk\": \"5.2.4\",\r\n\"@angular/common\": \"5.2.9\",\r\n\"@angular/compiler\": \"5.2.9\",\r\n\"@angular/core\": \"5.2.9\",\r\n\"@angular/forms\": \"5.2.9\",\r\n\"@angular/http\": \"5.2.9\",\r\n\"@angular/platform-browser\": \"5.2.9\",\r\n\"@angular/platform-browser-dynamic\": \"5.2.9\",\r\n\"@angular/router\": \"5.2.9\",\r\n\"@angular/compiler-cli\": \"5.2.9\",\r\n\"@ngtools/webpack\": \"1.10.2\",\r\n\"typescript\": \"2.7.2\",\r\n\"webpack\": \"3.11.0\",\r\n```\r\n\r\n### Repro steps\r\n**app-routing.module.ts**\r\n```\r\nexport const ROUTES: Routes = [\r\n {\r\n loadChildren: \"./student/student.module#StudentModule\",\r\n path: \"student\",\r\n },\r\n];\r\n```\r\n\r\n**student-routing.module.ts**\r\n```\r\nexport const ROUTES: Routes = [\r\n {\r\n loadChildren: \"./question/question.module#QuestionModule\",\r\n path: \"question\",\r\n },\r\n {\r\n loadChildren: \"./settings/settings.module#SettingsModule\",\r\n path: \"settings\",\r\n },\r\n];\r\n```\r\n\r\n**question-routing.module.ts**\r\n```\r\nexport const ROUTES: Routes = [\r\n {\r\n loadChildren: \"./settings/settings.module#SettingsModule\",\r\n path: \"settings\",\r\n },\r\n];\r\n```\r\n\r\n### Observed behavior\r\n```\r\nERROR in NaNbut they point to different modules \"(C:/Projects/Web/App/src/student/settings/settings.module.ts and \"C:/Projects/Web/App/src/student/questions/settings/settings.module.ts\"). Webpack cannot distinguish on context and would fail to load the proper one.\r\n```\r\n\r\n### Desired behavior\r\nWe have a lot of modules with the same names (settings, instructions, etc.), but they are belong to different parents with different urls, they are not exported outside of the parent's scope. It works fine with awesome-typescript-loader, angular-router-loader and angular2-template-loader. We expected the same behavior with `@ngtools/webpack`.\r\n\r\n\r\n### Mention any other details that might be useful (optional)\r\n\r\nI removed all other lazy modules from the project to check and this issue was still there.\r\nTried to use absolute paths as described here https://github.com/angular/angular-cli/issues/8722#issuecomment-366002955, but had another issue\r\n`ERROR in Could not resolve module App/src/student/student.module relative to C:/Projects/Web/App/src/app-routing.module.ts`\r\n\r\n**`tsconfig.json`**\r\n```\r\n{\r\n \"compilerOptions\": {\r\n \"emitDecoratorMetadata\": true,\r\n \"experimentalDecorators\": true,\r\n \"lib\": [ \"es2015\", \"dom\" ],\r\n \"module\": \"commonjs\",\r\n \"moduleResolution\": \"node\",\r\n \"removeComments\": true,\r\n \"skipLibCheck\": true,\r\n \"sourceMap\": true,\r\n \"target\": \"es5\"\r\n },\r\n \"exclude\": [\r\n \"node_modules\"\r\n ]\r\n}\r\n```\r\n\r\n**webpack.config**\r\n```\r\nconst srcPath = path.resolve(__dirname, \"App/src\");\r\n\r\nmodule.exports = {\r\n entry: {\r\n app: srcPath + \"/main.ts\",\r\n polyfills: srcPath + \"/polyfills.ts\",\r\n vendor: srcPath + \"/vendor.ts\",\r\n },\r\n resolve: {\r\n extensions: [\".ts\", \".js\"],\r\n },\r\n module: {\r\n loaders: [\r\n {\r\n test: /(?:\\.ngfactory\\.js|\\.ngstyle\\.js|\\.ts)$/,\r\n loader: \"@ngtools/webpack\",\r\n },\r\n ]\r\n },\r\n plugins: [\r\n new AngularCompilerPlugin({\r\n tsConfigPath: \"./tsconfig.json\",\r\n entryModule: \"./App/src/app.module#AppModule\",\r\n }),\r\n new webpack.optimize.ModuleConcatenationPlugin(),\r\n new HardSourceWebpackPlugin(),\r\n ]\r\n};\r\n```","author":{"url":"https://github.com/evgeniyefimov","@type":"Person","name":"evgeniyefimov"},"datePublished":"2018-04-02T10:23:14Z","url":"https://github.com/angular/angular-cli/issues/10128"}
| 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:8597e149-bd5c-bb12-e0e1-fb1767cc4137 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8F18:3F8AB1:19FB529:2112478:6B013368 |
| html-safe-nonce | 6b375f05d386ae5a824482638d45910357c761d4f77813e212d4808896ccad95 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjE4OjNGOEFCMToxOUZCNTI5OjIxMTI0Nzg6NkIwMTMzNjgiLCJ2aXNpdG9yX2lkIjoiNTE0NDcwMTk0MTM3NjQzMDk1MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2a7765305fcd3dfcbcc96d4e029623b4568baa229d92321def07cfba32859e50 |
| hovercard-subject-tag | issue:310450426 |
| 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/10128/issue_layout |
| twitter:image | https://opengraph.githubassets.com/303aa8bda493b585b6b66dce3abf38bc04d1becdb8420e2894bd8dd3f297502a/angular/angular-cli/issues/10128 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/303aa8bda493b585b6b66dce3abf38bc04d1becdb8420e2894bd8dd3f297502a/angular/angular-cli/issues/10128 |
| og:image:alt | Versions node: v8.11.0 npm: 5.7.1 Windows 10 "@angular/animations": "5.2.9", "@angular/cdk": "5.2.4", "@angular/common": "5.2.9", "@angular/compiler": "5.2.9", "@angular/core": "5.2.9", "@angular/f... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | evgeniyefimov |
| 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