Angular-cli: Ability to Disable `chunk optimization` for ng test command

Created on 11 Aug 2017  Â·  12Comments  Â·  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Desired functionality.

As a developer, I'd like to disable chunk optimization during compilation for ng test command. Current builds on a project with a few dozen components takes 36-60 seconds on this step depending on CLI version. This is bad for unit testing.

Mention any other details that might be useful.

Because of this issue #5775 AOT/chunk is really really slow and makes unit testing ghastly.

RFC / discussion / question

Most helpful comment

ng test doesn't use AOT by default, but it does bundle your project, which is also quite slow.

All 12 comments

Does ng test use AOT? I thought it was slow without it..

ng test doesn't use AOT by default, but it does bundle your project, which is also quite slow.

But build is slow only for the first time. You run ng test in a watch mode. It takes 30-60 seconds to build for the first time and than you just change you code and it reruns tests (taking only couple of seconds to rebuild). Or am I missing something?

@devoto13, on some systems it takes that long even during incremental reruns.

ng test --watch always does 92% chunk asset optimization EVERY TIME which goes on forever 30-60 seconds depending on CLI version. Sure, it incrementally compiles, but then it does the dreaded chunk step (which I previously believed was part of AOT). If it's not, then this feature request is to remove chunk asset optimization for ng-test

The "solution" to this is to turn off the source maps. Not sure about the state of the cheaper devTool options in webpack when using Typescript (they didn't use to work well), but if they do work it would be a huge bonus.

In my experience disabling source maps only marginally reduces the build time. It might save a few seconds, but when the chunk asset optimization step already goes on for a full 30 seconds, it isn't really much help.

This isn't something we have turned on or off, it's just something that webpack always does while bundling code. Turning off sourcemaps helps but I don't know of any way to disable it, nor do I think it's possible currently in Webpack.

Newer versions of the CLI also should heavily reduce that step in ng test since they use a vendor chunk (https://github.com/angular/angular-cli/pull/6160).

If someone shows me a repro where you see this behaviour I'd take a stab at diagnosing it though. Maybe there's more that can be done.

To clarify though: AOT doesn't exist in ng test.

The most recent version fixed incremental compile. It used to be
excruciating.

On Thu, Aug 17, 2017 at 11:20 AM Denis Loginov notifications@github.com
wrote:

@devoto13 https://github.com/devoto13, on some systems it takes that
long even during incremental reruns.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/angular/angular-cli/issues/7363#issuecomment-323152977,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAI4P3DL_YZiuvucokPdpTcXE6FrzgImks5sZIPQgaJpZM4O0_cP
.

>

The World's Longest Ongoing Illustration
ForeverScape.com http://www.foreverscape.com/ | @foreverscape
https://twitter.com/foreverscape | On Github
https://github.com/vance/foreverscapecore | In the News
http://www.foreverscape.com/art/reviews/

Thanks for reporting this issue. This issue was originally reported a long time ago and since then we've had many releases, one of which might have addressed this problem. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings