Closed tuurbo closed 8 years ago
Hi.
Do you have an example on how to build AOT only?
/* webpack.config.js */
...
entry: {
bundle: "./src/index", // <- remove this line to bundle only AoT version
bundle_aot: "./src/index-aot"
},
...
Also, the lazy loaded AOT bundles are larger than the JIT version. Is that suppose to be the case?
It is inevitable. "Using AoT" means that the sub module bundle files contain pre-compiled change detector codes(which are the same codes created by ng2 JiT compiler at runtime).
Commenting out the JIT bundle doesn't completely work. It still creates the JIT lazy load sub module chunk as seen below.
Hash: af432c9eb78def2b9117
Version: webpack 2.1.0-beta.24
Time: 5905ms
Asset Size Chunks Chunk Names
0.chunk.js 20.8 kB 0, 1 [emitted] <--- this is the AOT lazy load sub module
1.chunk.js 2.6 kB 1 [emitted] <--- this is the JIT lazy load sub module
bundle_aot.js 1.53 MB 2 [emitted] bundle_aot
+ 502 hidden modules
Also, thanks for explaining the AOT file sizes. Do you think it could be resolved in the future with something similar to the way ts-helpers
works?
I was able to temporarily fix the first part of my comment above by changing line 41 of angular2-load-children-loader
. https://github.com/Quramy/angular2-load-children-loader/blob/master/index.js#L41
from:
if (trimmed[0] !== '"' && trimmed[0] !== "'") return match;
to:
if (trimmed[0] !== '"' && trimmed[0] !== "'" || !addSuffix) return match;
Do you have an example on how to build AOT only? Because the dist folder contains JIT and AOT bundles and I don't want both versions pushed into production.
Also, the lazy loaded AOT bundles are larger than the JIT version. Is that suppose to be the case? It gets worse the more lazy loaded routes you add, because there seems to be a lot of duplicate code reused in the lazy loaded AOT bundles.
Thanks!