'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

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