{"action":"created","issue":{"url":"https://api.github.com/repos/hotforfeature/origami/issues/86","repository_url":"https://api.github.com/repos/hotforfeature/origami","labels_url":"https://api.github.com/repos/hotforfeature/origami/issues/86/labels{/name}","comments_url":"https://api.github.com/repos/hotforfeature/origami/issues/86/comments","events_url":"https://api.github.com/repos/hotforfeature/origami/issues/86/events","html_url":"https://github.com/hotforfeature/origami/issues/86","id":358762770,"node_id":"MDU6SXNzdWUzNTg3NjI3NzA=","number":86,"title":"Dynamic/defer importing the AppModule makes the app failed to compile","user":{"login":"dwiyatci","id":4405796,"node_id":"MDQ6VXNlcjQ0MDU3OTY=","avatar_url":"https://avatars1.githubusercontent.com/u/4405796?v=4","gravatar_id":"","url":"https://api.github.com/users/dwiyatci","html_url":"https://github.com/dwiyatci","followers_url":"https://api.github.com/users/dwiyatci/followers","following_url":"https://api.github.com/users/dwiyatci/following{/other_user}","gists_url":"https://api.github.com/users/dwiyatci/gists{/gist_id}","starred_url":"https://api.github.com/users/dwiyatci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwiyatci/subscriptions","organizations_url":"https://api.github.com/users/dwiyatci/orgs","repos_url":"https://api.github.com/users/dwiyatci/repos","events_url":"https://api.github.com/users/dwiyatci/events{/privacy}","received_events_url":"https://api.github.com/users/dwiyatci/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-10T19:33:40Z","updated_at":"2018-09-10T19:37:19Z","closed_at":null,"author_association":"NONE","body":"I did pretty much as instructed in my `main.ts`:\r\n\r\n```ts\r\nimport { enableProdMode } from '@angular/core';\r\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\r\nimport { webcomponentsReady } from '@codebakery/origami/polyfills';\r\n\r\n// import { AppModule } from './app/app.module';\r\nimport { environment } from './environments/environment';\r\n\r\nif (environment.production) {\r\n  enableProdMode();\r\n}\r\n\r\nwebcomponentsReady().then(() => {\r\n  // requires \"module: \"esnext\" in tsconfig.json\r\n  const { AppModule } = import('./app/app.module');\r\n  platformBrowserDynamic().bootstrapModule(AppModule);\r\n});\r\n```\r\n\r\nBut when I start the app (`yarn prepare:es5 && ng serve`), it throws the following error:\r\n`ERROR in Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options.`\r\n\r\nNot deferring the import of the AppModule works fine, though.\r\n\r\nWhat could have I missed here? 🤔 "},"comment":{"url":"https://api.github.com/repos/hotforfeature/origami/issues/comments/420034017","html_url":"https://github.com/hotforfeature/origami/issues/86#issuecomment-420034017","issue_url":"https://api.github.com/repos/hotforfeature/origami/issues/86","id":420034017,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMDAzNDAxNw==","user":{"login":"asyncLiz","id":34382620,"node_id":"MDQ6VXNlcjM0MzgyNjIw","avatar_url":"https://avatars1.githubusercontent.com/u/34382620?v=4","gravatar_id":"","url":"https://api.github.com/users/asyncLiz","html_url":"https://github.com/asyncLiz","followers_url":"https://api.github.com/users/asyncLiz/followers","following_url":"https://api.github.com/users/asyncLiz/following{/other_user}","gists_url":"https://api.github.com/users/asyncLiz/gists{/gist_id}","starred_url":"https://api.github.com/users/asyncLiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asyncLiz/subscriptions","organizations_url":"https://api.github.com/users/asyncLiz/orgs","repos_url":"https://api.github.com/users/asyncLiz/repos","events_url":"https://api.github.com/users/asyncLiz/events{/privacy}","received_events_url":"https://api.github.com/users/asyncLiz/received_events","type":"User","site_admin":false},"created_at":"2018-09-10T19:37:19Z","updated_at":"2018-09-10T19:37:19Z","author_association":"COLLABORATOR","body":"Dynamic `import()` returns a Promise, so you must wait for that resolved value. Looks like the documentation is incorrect.\r\n\r\n```\r\nwebcomponentsReady().then(() => {\r\n  // requires \"module: \"esnext\" in tsconfig.json\r\n  return import('./app/app.module');\r\n}).then(({ AppModule }) => {\r\n  platformBrowserDynamic().bootstrapModule(AppModule);\r\n});\r\n```\r\n\r\nI'll update the README to reflect that, thanks for catching it!"}}
{"actor":{"display_login":"asyncLiz"}}