Title: AOT - function calls are not supported with Module.forRoot · Issue #14707 · angular/angular · GitHub
Open Graph Title: AOT - function calls are not supported with Module.forRoot · Issue #14707 · angular/angular
X Title: AOT - function calls are not supported with Module.forRoot · Issue #14707 · angular/angular
Description: I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not submit support request here, instead see https://github.com/an...
Open Graph Description: I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not submit support request...
X Description: I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not su...
Opengraph URL: https://github.com/angular/angular/issues/14707
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"AOT - function calls are not supported with Module.forRoot ","articleBody":"\u003c!--\r\nIF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR ISSUE WITHOUT INVESTIGATING\r\n-->\r\n\r\n**I'm submitting a ...** (check one with \"x\")\r\n```\r\n[x] bug report => search github for a similar issue or PR before submitting\r\n[ ] feature 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```\r\n\r\n**Current behavior**\r\nWhen AOT compiling my project, it throws the following error:\r\n`Calling function 'PanelModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function.`\r\nEvent though I have no function/lambda functions on my PanelModule file.\r\n\r\n**Expected behavior**\r\nIt should continue compilation instead of breaking with a normal Module file.\r\n\r\n**Minimal reproduction of the problem with instructions**\r\n- Have 2 Angular 2 projects\r\n - One only exporting a Module with its components (PanelModule)\r\n - The other one as your main project which imports it:\r\n - Uses webpack 2.0\r\n - Use [@ultimate/aot-loader](https://github.com/UltimateAngular/aot-loader/wiki/Usage)\r\n - @angular/compiler-cli\r\n\r\n**app.module.ts**\r\n```typescript\r\nimport { NgModule } from \"@angular/core\";\r\nimport { APP_BASE_HREF } from \"@angular/common\";\r\nimport { BrowserModule, Title } from \"@angular/platform-browser\";\r\n\r\n// Providers\r\nimport { URL_BASE } from \"./config\";\r\nimport { CARBON_PROVIDERS } from \"angular2-carbonldp/boot\";\r\nimport { CARBON_SERVICES_PROVIDERS } from \"angular2-carbonldp/services\";\r\nimport { routing, appRoutingProviders } from \"./app.routing\";\r\n// Components\r\nimport { AppComponent } from \"./app.component\";\r\nimport { LoginView } from \"./login/login.view\";\r\n// Modules\r\nimport { PanelModule } from \"carbonldp-panel/panel.module\";\r\n\r\n@NgModule( {\r\n imports: [\r\n BrowserModule,\r\n routing,\r\n PanelModule.forRoot(), \u003c---- This line causes the issue\r\n ],\r\n declarations: [\r\n AppComponent,\r\n LoginView\r\n ],\r\n providers: [\r\n {\r\n provide: APP_BASE_HREF,\r\n useValue: URL_BASE\r\n },\r\n CARBON_PROVIDERS,\r\n CARBON_SERVICES_PROVIDERS,\r\n appRoutingProviders,\r\n Title,\r\n ],\r\n bootstrap: [ AppComponent ],\r\n} )\r\nexport class AppModule {}\r\n```\r\n\r\n**PanelModule**\r\n```typescript\r\n// Imports \r\n@NgModule( {\r\n imports: [\r\n CommonModule,\r\n RouterModule,\r\n SemanticModule,\r\n DirectivesModule,\r\n FormsModule\r\n ],\r\n declarations: [\r\n HeaderComponent,\r\n\t...\r\n PaginatorComponent,\r\n ],\r\n exports: [\r\n HeaderComponent,\r\n\t...\r\n PaginatorComponent,\r\n ],\r\n providers: []\r\n} )\r\n\r\nexport class PanelModule {\r\n static forRoot():ModuleWithProviders {\r\n return {\r\n ngModule: PanelModule,\r\n providers: [ HeaderService, SidebarService, RouterService, MyAppsSidebarService, ErrorsAreaService ]\r\n };\r\n }\r\n}\r\n```\r\n\r\nWith that configuration, every time I try to AOT compile the project it returns the error mentioned above, but, as you can see, I have no lambda function in my PanelModule forRoot file.\r\nIf I comment that line (`PanelModule.forRoot(),`) it continues compilation but I need that line to work. \r\n\r\n**What is the motivation / use case for changing the behavior?**\r\nThe AOT compilation should work because the files are AOT compliant.\r\n\r\n**Please tell us about your environment:**\r\nOS X Sierra.\r\n\r\n* **Angular version:** 2.0.X\r\n@angular@2.4.7\r\n@angular/compiler-cli@2.4.8\r\nWebpack@2.2.1\r\n\r\n* **Browser:** [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]\r\nall\r\n \r\n* **Language:** [all | TypeScript X.X | ES6/7 | ES5]\r\nTypescript@2.1.6\r\n\r\n* **Node (for AoT issues):** `node --version` = \r\nv6.2.0","author":{"url":"https://github.com/alvaro9210","@type":"Person","name":"alvaro9210"},"datePublished":"2017-02-24T17:04:12Z","url":"https://github.com/angular/angular/issues/14707"}
| 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:e4a6328b-0e30-de05-e389-bd46bd6086e8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA66:EA09B:26CE591:33780E2:6B01A627 |
| html-safe-nonce | 531eb7816a12202c32249ea27c76e6f8d5d68e2a6a85f43460f1687f163e95cd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTY2OkVBMDlCOjI2Q0U1OTE6MzM3ODBFMjo2QjAxQTYyNyIsInZpc2l0b3JfaWQiOiIzNDgwMTczNDExNDYyOTE1NjIzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ebd76c99f0b0bcaed1fab99ff7f12d004b398308ead7c3f1f3d66dd7a53c041a |
| hovercard-subject-tag | issue:210103518 |
| 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/14707/issue_layout |
| twitter:image | https://opengraph.githubassets.com/77b531614b1f99434234d9dac4fe29a9758ace27943765eaf3d49c2dda762977/angular/angular/issues/14707 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/77b531614b1f99434234d9dac4fe29a9758ace27943765eaf3d49c2dda762977/angular/angular/issues/14707 |
| og:image:alt | I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not submit support request... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | alvaro9210 |
| 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