Title: Incorrect NgModule resolution with library and npm link · Issue #35447 · angular/angular · GitHub
Open Graph Title: Incorrect NgModule resolution with library and npm link · Issue #35447 · angular/angular
X Title: Incorrect NgModule resolution with library and npm link · Issue #35447 · angular/angular
Description: 🐞 bug report Affected Package The issue is probably caused by package @angular/compiler-cli. Is this a regression? Yes, the previous version in which this bug was not present was: ^8.2.0 (not using Ivy) Description For our project we are...
Open Graph Description: 🐞 bug report Affected Package The issue is probably caused by package @angular/compiler-cli. Is this a regression? Yes, the previous version in which this bug was not present was: ^8.2.0 (not using...
X Description: 🐞 bug report Affected Package The issue is probably caused by package @angular/compiler-cli. Is this a regression? Yes, the previous version in which this bug was not present was: ^8.2.0 (not using...
Opengraph URL: https://github.com/angular/angular/issues/35447
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incorrect NgModule resolution with library and npm link","articleBody":"# 🐞 bug report\r\n\r\n### Affected Package\r\n\u003c!-- Can you pin-point one or more @angular/* packages as the source of the bug? -->\r\n\u003c!-- ✍️edit: --> The issue is probably caused by package @angular/compiler-cli.\r\n\r\n\r\n### Is this a regression?\r\n\r\n\u003c!-- Did this behavior use to work in the previous version? -->\r\n\u003c!-- ✍️--> Yes, the previous version in which this bug was not present was:\r\n^8.2.0 (not using Ivy)\r\n\r\n\r\n### Description\r\n\r\n\u003c!-- ✍️-->\r\nFor our project we are using Angular workspace combined with [lerna](https://github.com/lerna/lerna) (we use lerna mainly to handle versioning and release of our libraries as npm packages). We have a single application and multiple packages. After upgrading to Angular 9, we are getting the following error when trying to build the application:\r\n> Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class\r\n\r\nBecause we use lerna, our libraries are linked inside `node_modules`, which seems to be the problem (and possibly makes this different from the other github issues with the same error). If we remove the link in `node_modules`, the app builds as expected.\r\n\r\n## 🔬 Minimal Reproduction\r\nhttps://github.com/IgorAufricht/angular-import-not-resolved-repro\r\n\r\nThe steps are included in the readme, but for clarity, here they are:\r\n* `git clone https://github.com/IgorAufricht/angular-import-not-resolved-repro.git && cd angular-import-not-resolved-repro`\r\n* `npm install`\r\n* `ng build lib1 --prod && ng build --prod` (builds correctly)\r\n* `cd projects/lib1 && npm link && cd ../.. && npm link lib1` (1)\r\n* `ng build lib1 --prod && ng build --prod` (fails)\r\n\r\n(1) With our lerna setup we use yarn workspaces, but it creates the links in `node_modules` in the same way.\r\n\r\n## 🔥 Exception or Error\r\n\u003cpre>\u003ccode>ERROR in dist/lib1/lib/lib1.module.d.ts:1:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class\r\n\r\n1 export declare class Lib1Module {\r\n ~~~~~~~~~~\u003c/code>\u003c/pre>\r\n\r\n\r\n## 🌍 Your Environment\r\n\r\n**Angular Version:**\r\n\u003cpre>\u003ccode>Angular CLI: 9.0.2\r\nNode: 12.13.1\r\nOS: win32 x64\r\n\r\nAngular: 9.0.1\r\n... animations, common, compiler, compiler-cli, core, forms\r\n... language-service, platform-browser, platform-browser-dynamic\r\n... router\r\nIvy Workspace: Yes\r\n\r\nPackage Version\r\n------------------------------------------------------------\r\n@angular-devkit/architect 0.900.2\r\n@angular-devkit/build-angular 0.900.2\r\n@angular-devkit/build-ng-packagr 0.900.2\r\n@angular-devkit/build-optimizer 0.900.2\r\n@angular-devkit/build-webpack 0.900.2\r\n@angular-devkit/core 9.0.2\r\n@angular-devkit/schematics 9.0.2\r\n@angular/cli 9.0.2\r\n@ngtools/webpack 9.0.2\r\n@schematics/angular 9.0.2\r\n@schematics/update 0.900.2\r\nng-packagr 9.0.0\r\nrxjs 6.5.4\r\ntypescript 3.7.5\r\nwebpack 4.41.2\u003c/code>\u003c/pre>\r\n\r\n**Anything else relevant?**\r\nRelated issue: #35255\r\n","author":{"url":"https://github.com/IgorAufricht","@type":"Person","name":"IgorAufricht"},"datePublished":"2020-02-14T16:03:21Z","url":"https://github.com/angular/angular/issues/35447"}
| 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:33a5db58-57ca-36ee-6641-f0824e964749 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B19A:31E99C:1419EBA:1AD6B34:6B012CD9 |
| html-safe-nonce | b881eab93785334a15048c89b8198d72e426d519b0663925ae0ed271dda521d4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMTlBOjMxRTk5QzoxNDE5RUJBOjFBRDZCMzQ6NkIwMTJDRDkiLCJ2aXNpdG9yX2lkIjoiNzQ2NDg3MDEyNjgxMTE2Mzg2NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8bb844adc2b9e1a8ab1dd4a060df255375c4ef52d6e91404c2ce385a2bdbcc7d |
| hovercard-subject-tag | issue:565416853 |
| 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/35447/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a4809d2fd05ca2578828c29a0dee984b4f1b43ea61807d61f656bc9df72563f5/angular/angular/issues/35447 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a4809d2fd05ca2578828c29a0dee984b4f1b43ea61807d61f656bc9df72563f5/angular/angular/issues/35447 |
| og:image:alt | 🐞 bug report Affected Package The issue is probably caused by package @angular/compiler-cli. Is this a regression? Yes, the previous version in which this bug was not present was: ^8.2.0 (not using... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | IgorAufricht |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| 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