Skip to content

Lazy load and AOT : Working but splitted chunk ONLY WITH AOT FLAG #3267

@maxime1992

Description

@maxime1992

Please provide us with the following information:

OS?

Ubuntu 16.10 (x64)

Versions.

angular-cli: 1.0.0-beta.21

Repro steps.

After I read more about lazy load + AOT on this issue, I decided to give a try and it's working really nice for the first time in my app.

So I decided to have some fun and benchmark different results. Here's the ouput :

+-----------------------+-------------+--------------+-----------+-------------+
|                       | Main bundle |   Chunk 0    | Scripting | First paint |
+-----------------------+-------------+--------------+-----------+-------------+
| ng serve              | 4.5 MB      | Not splitted | 6075 ms   | 5500+ ms    |
| ng serve --prod       | 334 KB      | Not splitted | 5587 ms   | 4750+ ms    |
| ng serve --aot        | 3.3 MB      | 326 KB       | 4011 ms   | 4400+ ms    |
| ng serve --prod --aot | 243 KB      | 18.1 Kb      | 3860 ms   | 4250+ ms    |
+-----------------------+-------------+--------------+-----------+-------------+
  • The --prod --aot build size is 27% smaller than --prod build
  • The --prod --aot build is 31% faster when scripting than --prod build
  • AOT is cool !

BUT

As you can see, ng serve and ng serve --prod doesn't have the chunk expected and I'm able to find the code (that's supposed to be in the chunk) inside the main bundle. With aot flag, I always have both the main bundle and my chunk.

Even tho it's working, devs who want to put their app in prod without building with --aot will not enjoy the lazy loading they've setup ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: repro stepsWe cannot reproduce the issue with the information given

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions