Title: bug(compiler-cli): metadata resolution error when generating flat module with reference in re-export · Issue #20931 · angular/angular · GitHub
Open Graph Title: bug(compiler-cli): metadata resolution error when generating flat module with reference in re-export · Issue #20931 · angular/angular
X Title: bug(compiler-cli): metadata resolution error when generating flat module with reference in re-export · Issue #20931 · angular/angular
Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [x] Bug report [ ] Feature request [ ] Documentation issue or request [ ] Support request => Please do not submit support request here...
Open Graph Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [x] Bug report [ ] Feature request [ ] Documentation issue or request [ ] Support request => P...
X Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [x] Bug report [ ] Feature request [ ] Documentation issue or request [ ] Support request ...
Opengraph URL: https://github.com/angular/angular/issues/20931
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug(compiler-cli): metadata resolution error when generating flat module with reference in re-export","articleBody":"\u003c!--\r\nPLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.\r\n\r\nISSUES MISSING IMPORTANT INFORMATION MAY BE CLOSED WITHOUT INVESTIGATION.\r\n-->\r\n\r\n## I'm submitting a...\r\n\u003c!-- Check one of the following options with \"x\" -->\r\n\u003cpre>\u003ccode>\r\n[ ] Regression (a behavior that used to work and stopped working in a new release)\r\n[x] Bug report \u003c!-- Please search GitHub for a similar issue or PR before submitting -->\r\n[ ] Feature request\r\n[ ] Documentation issue or request\r\n[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n\u003c/code>\u003c/pre>\r\n\r\n## Current behavior\r\n\u003c!-- Describe how the issue manifests. -->\r\n\r\n#### GIVEN\r\n\r\nThere is a `HelloComponent` in `app/components/hello.component`.\r\nThere is a re-export of `HelloComponent` in `app/components.ts`, like:\r\n\r\n```typescript\r\nexport * from './components/hello.component'\r\n```\r\n\r\nIn `app.module.ts`, import `HelloComponent` from `app/components.ts` (re-export), like:\r\n\r\n```typescript\r\n// ...\r\nimport { HelloComponent } from './components'\r\n\r\n@NgModule({\r\n declarations: [\r\n // ...\r\n HelloComponent,\r\n ],\r\n // ...\r\n})\r\nexport class AppModule { }\r\n```\r\n\r\n\u003csub>Checked not relates to filename.\u003c/sub>\r\n\r\n#### WHEN\r\n\r\nConfig it to generate a flat module:\r\n\r\n```json\r\n{\r\n \"angularCompilerOptions\": {\r\n \"flatModuleId\": \"hello\",\r\n \"flatModuleOutFile\": \"hello.js\",\r\n \"skipTemplateCodegen\": true\r\n }\r\n}\r\n```\r\n\r\nAnd call AOT compiler via `ngc`.\r\n\r\n#### THEN\r\n\r\nAn error occur:\r\n\r\n```text\r\nMACHINE_NAME:aot-reexport-issue zjyu$ $(yarn bin)/ngc -p src/tsconfig.app.json\r\n: TypeError: Cannot read property 'module' of undefined\r\n at MetadataBundler.convertSymbol (/Users/USER_NAME/Projects/github/trotyl/aot-reexport-issue/node_modules/@angular/compiler-cli/src/metadata/bundler.js:264:57)\r\n at createReference (/Users/USER_NAME/Projects/github/trotyl/aot-reexport-issue/node_modules/@angular/compiler-cli/src/metadata/bundler.js:390:23)\r\n at MetadataBundler.convertReference (/Users/USER_NAME/Projects/github/trotyl/aot-reexport-issue/node_modules/@angular/compiler-cli/src/metadata/bundler.js:438:24)\r\n at MetadataBundler.convertExpression (/Users/USER_NAME/Projects/github/trotyl/aot-reexport-issue/node_modules/@angular/compiler-cli/src/metadata/bundler.js:367:33)\r\n at MetadataBundler.convertValue (/Users/USER_NAME/Projects/github/trotyl/aot-reexport-issue/node_modules/@angular/compiler-cli/src/metadata/bundler.js:348:25)\r\n at /Users/USER_NAME/Projects/github/trotyl/aot-reexport-issue/node_modules/@angular/compiler-cli/src/metadata/bundler.js:351:58\r\n at Array.map (\u003canonymous>)\r\n at MetadataBundler.convertValue (/Users/USER_NAME/Projects/github/trotyl/aot-reexport-issue/node_modules/@angular/compiler-cli/src/metadata/bundler.js:351:26)\r\n at MetadataBundler.convertValue (/Users/USER_NAME/Projects/github/trotyl/aot-reexport-issue/node_modules/@angular/compiler-cli/src/metadata/bundler.js:357:32)\r\n at /Users/USER_NAME/Projects/github/trotyl/aot-reexport-issue/node_modules/@angular/compiler-cli/src/metadata/bundler.js:351:58\r\n```\r\n\r\nThe error is caused by [this line](https://github.com/angular/angular/blob/a75040d0a15c06cc8250032f044b7df0ed885317/packages/compiler-cli/src/metadata/bundler.ts#L343), `canonicalSymbol` doesn't have a `declaration` property in this scenario. \r\n\r\n\r\n## Expected behavior\r\n\u003c!-- Describe what the desired behavior would be. -->\r\n\r\nBe able to compile.\r\n\r\n\r\n## Minimal reproduction of the problem with instructions\r\n\u003c!--\r\nFor bug reports please provide the *STEPS TO REPRODUCE* and if possible a *MINIMAL DEMO* of the problem via\r\nhttps://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5).\r\n-->\r\n\r\nhttps://github.com/trotyl/aot-reexport-issue\r\n\r\nSteps mentioned there.\r\n\r\n## What is the motivation / use case for changing the behavior?\r\n\u003c!-- Describe the motivation or the concrete use case. -->\r\n\r\nBe able to get codes work.\r\n\r\n## Environment\r\n\r\n\u003cpre>\u003ccode>\r\nAngular version: 5.1.0\r\n\u003c!-- Check whether this is still an issue in the most recent Angular version -->\r\n\r\nBrowser:\r\n- [ ] Chrome (desktop) version XX\r\n- [ ] Chrome (Android) version XX\r\n- [ ] Chrome (iOS) version XX\r\n- [ ] Firefox version XX\r\n- [ ] Safari (desktop) version XX\r\n- [ ] Safari (iOS) version XX\r\n- [ ] IE version XX\r\n- [ ] Edge version XX\r\n \r\nFor Tooling issues:\r\n- Node version: 8.9.2 \u003c!-- run `node --version` -->\r\n- Platform: Mac \u003c!-- Mac, Linux, Windows -->\r\n\r\nOthers:\r\n\u003c!-- Anything else relevant? Operating system version, IDE, package manager, HTTP server, ... -->\r\n\u003c/code>\u003c/pre>\r\n","author":{"url":"https://github.com/trotyl","@type":"Person","name":"trotyl"},"datePublished":"2017-12-11T09:37:27Z","url":"https://github.com/angular/angular/issues/20931"}
| 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:dc014d6f-fb1b-17b8-8722-fd7bfffa9b32 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A954:134361:9BA524:CED72C:6B00E53D |
| html-safe-nonce | 08122ca2463f9001c6912742e5d782064e16a4ab0fc1f88c366d5cfbe462d7e8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTU0OjEzNDM2MTo5QkE1MjQ6Q0VENzJDOjZCMDBFNTNEIiwidmlzaXRvcl9pZCI6IjUzNDI3OTQxNjUzMDQ0ODUxODEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3d855d23933407dac5e7844b9d9d73ad3ba165c825438afa10253ac2a8d9403b |
| hovercard-subject-tag | issue:280949916 |
| 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/20931/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e5c8a5622d6497ebc34f84a4451ce509ae3f5ad628186a704162d9cbfc4e5bdd/angular/angular/issues/20931 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e5c8a5622d6497ebc34f84a4451ce509ae3f5ad628186a704162d9cbfc4e5bdd/angular/angular/issues/20931 |
| og:image:alt | I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [x] Bug report [ ] Feature request [ ] Documentation issue or request [ ] Support request => P... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | trotyl |
| hostname | github.com |
| expected-hostname | github.com |
| None | 27088b6977484d0d3321d9a11c907c6d6637b315cfa359ef7952dbf6292f9b14 |
| 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 | 624179fb8b88d26ba5bba08894eb60a1c5a1d93d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width