'Custom element created with Angular Elements / Angular 13 causes 'JIT compilation failed for NgModule'
I am building a Web Components custom element using Angular Elements. My custom element uses a non-Ivy library which causes it to fail at runtime. Browser JS console produces the following output:
JIT compilation failed for NgModule class DropDownListModule {}
JIT compilation is discouraged for production use-cases! Consider using AOT mode instead.
Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server',
or manually provide the compiler with 'import "@angular/compiler";' before bootstrapping
- I have included "ngcc" as a postinstall script in my package.json.
- I have a bundle script that concatenates the runtime, polyfills, main, and vendor bundles into a single bundle for use in loading the custom element
- I tried setting up the Angular Linker babel plugin as described here: https://angular.io/guide/creating-libraries#consuming-partial-ivy-code-outside-the-angular-cli ...to no avail
How can I include the necessary assets in my bundle to support non Ivy libraries in a custom element?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
