Title: Including moduleId property in @Component decorator causes 'Module build failed: TypeError: Cannot read property 'getChildAt' of undefined' · Issue #4817 · angular/angular-cli · GitHub
Open Graph Title: Including moduleId property in @Component decorator causes 'Module build failed: TypeError: Cannot read property 'getChildAt' of undefined' · Issue #4817 · angular/angular-cli
X Title: Including moduleId property in @Component decorator causes 'Module build failed: TypeError: Cannot read property 'getChildAt' of undefined' · Issue #4817 · angular/angular-cli
Description: Please provide us with the following information: OS? OS Name Microsoft Windows 10 Pro Version 10.0.14393 Build 14393 Versions. @angular/cli: 1.0.0-beta.32.3 [1.0.0-beta.31] node: 6.9.5 os: win32 x64 @angular/common: 2.4.7 @angular/compi...
Open Graph Description: Please provide us with the following information: OS? OS Name Microsoft Windows 10 Pro Version 10.0.14393 Build 14393 Versions. @angular/cli: 1.0.0-beta.32.3 [1.0.0-beta.31] node: 6.9.5 os: win32 x...
X Description: Please provide us with the following information: OS? OS Name Microsoft Windows 10 Pro Version 10.0.14393 Build 14393 Versions. @angular/cli: 1.0.0-beta.32.3 [1.0.0-beta.31] node: 6.9.5 os: win32 x...
Opengraph URL: https://github.com/angular/angular-cli/issues/4817
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Including moduleId property in @Component decorator causes 'Module build failed: TypeError: Cannot read property 'getChildAt' of undefined'","articleBody":"> Please provide us with the following information:\r\n> ---------------------------------------------------------------\r\n\r\n### OS?\r\n> OS Name\tMicrosoft Windows 10 Pro\r\nVersion\t10.0.14393 Build 14393\r\n\r\n\r\n\r\n### Versions.\r\n> @angular/cli: 1.0.0-beta.32.3 [1.0.0-beta.31]\r\nnode: 6.9.5\r\nos: win32 x64\r\n@angular/common: 2.4.7\r\n@angular/compiler: 2.4.7\r\n@angular/core: 2.4.7\r\n@angular/forms: 2.4.7\r\n@angular/http: 2.4.7\r\n@angular/platform-browser: 2.4.7\r\n@angular/platform-browser-dynamic: 2.4.7\r\n@angular/router: 3.4.7\r\n@angular/cli: 1.0.0-beta.32.3\r\n@angular/compiler-cli: 2.4.7\r\n\r\n\r\n\r\n### Repro steps.\r\n> Adding in `moduleId` property to `@Component` decorator for code shared with a NativeScript build\r\n\r\n### The log given by the failure.\r\n> ERROR in ./clients/shared/app/app.component.ts\r\nModule build failed: TypeError: Cannot read property 'getChildAt' of undefined\r\n at refactor.findAstNodes.filter.forEach (C:\\Users\\Keith\\Source\\Repos\\TaskTrain\\node_modules\\@ngtools\\webpack\\src\\loader.js:222:54)\r\n at Array.forEach (native)\r\n at _removeModuleId (C:\\Users\\Keith\\Source\\Repos\\TaskTrain\\node_modules\\@ngtools\\webpack\\src\\loader.js:214:10)\r\n at Promise.resolve.then.then (C:\\Users\\Keith\\Source\\Repos\\TaskTrain\\node_modules\\@ngtools\\webpack\\src\\loader.js:312:33)\r\n at process._tickCallback (internal/process/next_tick.js:103:7)\r\n @ ./clients/shared/app/app.module.ts 12:0-47\r\n @ ./clients/browser/main.ts\r\n @ multi webpack-dev-server/client?http://localhost:4200/ ./clients/browser/main.ts\r\n\r\n`Console.log(moduleIdProp);` in `@ngtools\\webpack\\src\\loader.js` at line 257 shows `parent` property `undefined`:\r\n>NodeObject {\r\n pos: 132,\r\n end: 155,\r\n flags: 0,\r\n transformFlags: undefined,\r\n parent: undefined,\r\n kind: 257,\r\n modifiers: undefined,\r\n name: \r\n IdentifierObject {\r\n pos: 132,\r\n end: 144,\r\n flags: 0,\r\n parent: undefined,\r\n text: 'moduleId' },\r\n questionToken: undefined,\r\n initializer: \r\n NodeObject {\r\n pos: 145,\r\n end: 155,\r\n flags: 0,\r\n transformFlags: undefined,\r\n parent: undefined,\r\n kind: 177,\r\n expression: \r\n IdentifierObject {\r\n pos: 145,\r\n end: 152,\r\n flags: 0,\r\n parent: undefined,\r\n originalKeywordKind: 127,\r\n text: 'module' },\r\n name: IdentifierObject { pos: 153, end: 155, flags: 0, parent: undefined, text: 'id' },\r\n _children: [ [Object], [Object], [Object] ] },\r\n _children: \r\n [ IdentifierObject {\r\n pos: 132,\r\n end: 144,\r\n flags: 0,\r\n parent: undefined,\r\n text: 'moduleId' },\r\n TokenObject { pos: 144, end: 145, flags: 0, parent: [Circular], kind: 55 },\r\n NodeObject {\r\n pos: 145,\r\n end: 155,\r\n flags: 0,\r\n transformFlags: undefined,\r\n parent: undefined,\r\n kind: 177,\r\n expression: [Object],\r\n name: [Object],\r\n _children: [Object] } ] }\r\n\r\n### Mention any other details that might be useful.\r\nMoving the `moduleId` property to the last position in the `@Component` decorator and monkey patching `@ngtools\\webpack\\src\\loader.js` as follows allows a successful build.\r\n\r\n```\r\n// get the trailing comma\r\n // const moduleIdCommaProp = moduleIdProp.parent.getChildAt(1).getChildren()[1];\r\n // refactor.removeNodes(moduleIdProp, moduleIdCommaProp);\r\n refactor.removeNodes(moduleIdProp);\r\n```\r\n> ---------------------------------------------------------------\r\n> Thanks! We'll be in touch soon.\r\n","author":{"url":"https://github.com/KeithGillette","@type":"Person","name":"KeithGillette"},"datePublished":"2017-02-18T18:48:21Z","url":"https://github.com/angular/angular-cli/issues/4817"}
| 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:702ed7e7-80c1-346c-3f31-43ab6801dea1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B3DA:F8C5C:129829A:175BF3C:6B0241C0 |
| html-safe-nonce | 164875ec34fa8a9b59b2765b2632e708710a2b141800358c6db1d57d2e3166a2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCM0RBOkY4QzVDOjEyOTgyOUE6MTc1QkYzQzo2QjAyNDFDMCIsInZpc2l0b3JfaWQiOiIzODQ3MTc0NjE3Mzk5NzA2MDQ4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e3b5cd264c765ab28fa980c142c31ef4e59b291a85583e04c76ac7fb181fb5dd |
| hovercard-subject-tag | issue:208661255 |
| 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/4817/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c64d278e966c04a4bd7f63b3a5a623b13010c199d20b9a49e62b4c46c3d64ba6/angular/angular-cli/issues/4817 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c64d278e966c04a4bd7f63b3a5a623b13010c199d20b9a49e62b4c46c3d64ba6/angular/angular-cli/issues/4817 |
| og:image:alt | Please provide us with the following information: OS? OS Name Microsoft Windows 10 Pro Version 10.0.14393 Build 14393 Versions. @angular/cli: 1.0.0-beta.32.3 [1.0.0-beta.31] node: 6.9.5 os: win32 x... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | KeithGillette |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width