Title: Runtime errors when using buildOptimizer. JIT compilation broken. · Issue #17663 · angular/angular-cli · GitHub
Open Graph Title: Runtime errors when using buildOptimizer. JIT compilation broken. · Issue #17663 · angular/angular-cli
X Title: Runtime errors when using buildOptimizer. JIT compilation broken. · Issue #17663 · angular/angular-cli
Description: 🐞 Bug report Command (mark with an x) new build serve test e2e generate add update lint xi18n run config help version doc Is this a regression? I don't know. I would guess this is a recent thing arising from the introduction of AOT, Ivy,...
Open Graph Description: 🐞 Bug report Command (mark with an x) new build serve test e2e generate add update lint xi18n run config help version doc Is this a regression? I don't know. I would guess this is a recent thing ar...
X Description: 🐞 Bug report Command (mark with an x) new build serve test e2e generate add update lint xi18n run config help version doc Is this a regression? I don't know. I would guess this is a recent thin...
Opengraph URL: https://github.com/angular/angular-cli/issues/17663
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Runtime errors when using buildOptimizer. JIT compilation broken.","articleBody":"# 🐞 Bug report\r\n\r\n### Command (mark with an `x`)\r\n\u003c!-- Can you pin-point the command or commands that are effected by this bug? -->\r\n\u003c!-- ✍️edit: -->\r\n\r\n- [ ] new\r\n- [X] build\r\n- [X] serve\r\n- [ ] test\r\n- [ ] e2e\r\n- [ ] generate\r\n- [ ] add\r\n- [ ] update\r\n- [ ] lint\r\n- [ ] xi18n\r\n- [ ] run\r\n- [ ] config\r\n- [ ] help\r\n- [ ] version\r\n- [ ] doc\r\n\r\n### Is this a regression?\r\nI don't know. I would guess this is a recent thing arising from the introduction of AOT, Ivy, and the build optimizer.\r\n\r\n### Description\r\nWe faced an issue with an application we were developing where the legacy application had content stored in a database. This content is essentially an Angular template and could not be known at compile-time. The situations and constraints in the project led us to create dynamic components/modules on the fly. This worked beautifully in development and then failed when deployed to production. \r\n\r\nIn diagnosis, this works as long as the build optimizer is NOT enabled. Having a production build, with the optimizer, but without the buildOptimizer, enabled still works.\r\n\r\nI believe I've seen unofficially in other issues that using AOT and JIT together, but since it works with the `buildOptimizer` disabled, this feels like an issue with the optimizer.\r\n\r\n## 🔬 Minimal Reproduction\r\nHere is a [reproduction repo](https://github.com/jcgillespie/ng-dynamic-optimized-repro)\r\nOnce you've `npm install`'d, you can run the repro this way.\r\n`ng serve` \u003c-- working\r\n`ng serve --configuration=production` \u003c--working\r\n`ng serve --configuration=production-build-optimized` \u003c-- broken.\r\nThe only difference between the configurations is the `buildOptimizer` setting.\r\nYou can run all three side-by-side-by-side by adding different `--port` values.\r\n\r\nIn a working build, you'll see an additional \"Runtime Hello!\" message as well as the Angular logo. When broken, those elements will be missing and there will be a console error. \r\n\r\nIf this isn't a bug, that error message is misleading for this situation.. :) \r\n\r\n## 🔥 Exception or Error\r\n\u003cpre>\u003ccode>\r\nmain.7000374ef126bad8069c.js:1 ERROR Error: Uncaught (in promise): Error: Angular JIT compilation failed: '@angular/compiler' not loaded!\r\n - JIT compilation is discouraged for production use-cases! Consider AOT mode instead.\r\n - Did you bootstrap using '@angular/platform-browser-dynamic' or '@angular/platform-server'?\r\n - Alternatively provide the compiler with 'import \"@angular/compiler\";' before bootstrapping.\r\nError: Angular JIT compilation failed: '@angular/compiler' not loaded!\r\n - JIT compilation is discouraged for production use-cases! Consider AOT mode instead.\r\n - Did you bootstrap using '@angular/platform-browser-dynamic' or '@angular/platform-server'?\r\n - Alternatively provide the compiler with 'import \"@angular/compiler\";' before bootstrapping.\r\n at Ae (main.7000374ef126bad8069c.js:1)\r\n at Function.get (main.7000374ef126bad8069c.js:1)\r\n at St (main.7000374ef126bad8069c.js:1)\r\n at new Af (main.7000374ef126bad8069c.js:1)\r\n at ud (main.7000374ef126bad8069c.js:1)\r\n at dd (main.7000374ef126bad8069c.js:1)\r\n at e.md [as compileModuleAndAllComponentsAsync] (main.7000374ef126bad8069c.js:1)\r\n at e.\u003canonymous> (main.7000374ef126bad8069c.js:1)\r\n at Generator.next (\u003canonymous>)\r\n at main.7000374ef126bad8069c.js:1\r\n at T (polyfills.a8d522dff2c1a5c4b9db.js:1)\r\n at polyfills.a8d522dff2c1a5c4b9db.js:1\r\n at a (main.7000374ef126bad8069c.js:1)\r\n at l.invoke (polyfills.a8d522dff2c1a5c4b9db.js:1)\r\n at Object.onInvoke (main.7000374ef126bad8069c.js:1)\r\n at l.invoke (polyfills.a8d522dff2c1a5c4b9db.js:1)\r\n at i.run (polyfills.a8d522dff2c1a5c4b9db.js:1)\r\n at polyfills.a8d522dff2c1a5c4b9db.js:1\r\n at l.invokeTask (polyfills.a8d522dff2c1a5c4b9db.js:1)\r\n at Object.onInvokeTask (main.7000374ef126bad8069c.js:1)\r\n\u003c/code>\u003c/pre>\r\n\r\n\r\n## 🌍 Your Environment\r\n\u003cpre>\u003ccode>\r\n\r\n _ _ ____ _ ___\r\n / \\ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|\r\n / △ \\ | '_ \\ / _` | | | | |/ _` | '__| | | | | | |\r\n / ___ \\| | | | (_| | |_| | | (_| | | | |___| |___ | |\r\n /_/ \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_| \\____|_____|___|\r\n |___/\r\n \r\n\r\nAngular CLI: 9.1.4\r\nNode: 13.11.0\r\nOS: darwin x64\r\n\r\nAngular: 9.1.4\r\n... animations, cli, 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.901.4\r\n@angular-devkit/build-angular 0.901.4\r\n@angular-devkit/build-optimizer 0.901.4\r\n@angular-devkit/build-webpack 0.901.4\r\n@angular-devkit/core 9.1.4\r\n@angular-devkit/schematics 9.1.4\r\n@ngtools/webpack 9.1.4\r\n@schematics/angular 9.1.4\r\n@schematics/update 0.901.4\r\nrxjs 6.5.5\r\ntypescript 3.8.3\r\nwebpack 4.42.0\r\n \r\n\u003c/code>\u003c/pre>\r\n\r\n**Anything else relevant?**\r\n\r\n","author":{"url":"https://github.com/jcgillespie","@type":"Person","name":"jcgillespie"},"datePublished":"2020-05-07T18:50:13Z","url":"https://github.com/angular/angular-cli/issues/17663"}
| 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:b8247cdb-4216-fa85-e002-030d5946a56c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C93A:3D8CBB:102345E:1559B51:6B0109B2 |
| html-safe-nonce | b4d606fe147f82f593a14c5cd697dadc5cb22db05ae9ac9c28820682ba2ee6ab |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOTNBOjNEOENCQjoxMDIzNDVFOjE1NTlCNTE6NkIwMTA5QjIiLCJ2aXNpdG9yX2lkIjoiNjczNTU4ODU2MjYwMDc5MDQ1MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6a682769c8c8c3a5a7440134d8b5458830e80a0d8fd7025a50f0f3fce99cfcf4 |
| hovercard-subject-tag | issue:614269799 |
| 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/17663/issue_layout |
| twitter:image | https://opengraph.githubassets.com/24e3ec0be1f54bb47e3ff3ca5ce192d216c00912f3f7aef81399ad280bf41e20/angular/angular-cli/issues/17663 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/24e3ec0be1f54bb47e3ff3ca5ce192d216c00912f3f7aef81399ad280bf41e20/angular/angular-cli/issues/17663 |
| og:image:alt | 🐞 Bug report Command (mark with an x) new build serve test e2e generate add update lint xi18n run config help version doc Is this a regression? I don't know. I would guess this is a recent thing ar... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jcgillespie |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width