AoT compilation for modules?
First, thank you for posting this repo - it is very helpful.
Do you know if it is possible to use this technique (or another similar technique) with modules that are compiled with AoT instead of lazy loading?
Thanks!
Hey!
Nice to hear! To be honest, the initial trigger for this project was to investigate the possibilities of loading 'modules' (in this case primarily UMD) using lazy loading (and unknown at compile time).
I'll write it down and take a look at it later!
I think AOT is not working but README states the opposite. Try:
-
ng build --prod --aot -
http-server ./dist/angular-dynamic-demoWhat you get ismodule not founderror in console. I tried to rebuild all modules with AOT(build --prod moduleX) and repace them inassetsbut this thoes not help. Any ideas how all this can work in AOT mode? The point is to stay optimized and NOT send the compiler to the browser. @lmeijdam ^
@kkartunov I See, strange! It's not that I haven't test this out before 'claiming' it was working with AoT. I've actually a couple of versions of this project and I see that none of them is building AoT any more. It did before.
I;ve actually tested this a few months ago with ng build --prod and ng build --prod --build-optimizer=false, both were working. I'll check it out, when I got the time.
You're also free to fork it and try some stuff out;)
I think issue is with build-optimizer, This will work like AOT without optimized build. ng build --prod --aot --build-optimizer=false
Hi @lmeijdam, thanks for your great job !
I'm currently working on Angular 7.
AS you said, all was fine with JIT compilation, but with AOT, I had to use "--build-optimizer=false". But in your polyfills there is:
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. import 'core-js/es7/reflect';
In my case, I need this in my polyfills:
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
If not, i'm getting this error:

Because I'm working with third party library, I'm interrested by using build-optimizer. It is reducing my app size a lot. Do we have an idea of where the problem comes from ? Does someone have an idea how to use build-optimizer ?
Did you manage to get this working?