angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Ability to Disable `chunk optimization` for ng test command

Open vance opened this issue 9 years ago • 12 comments

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.

vance avatar Aug 11 '17 18:08 vance

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

dinvlad avatar Aug 16 '17 22:08 dinvlad

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

Simon-Briggs avatar Aug 17 '17 04:08 Simon-Briggs

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 avatar Aug 17 '17 15:08 devoto13

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

dinvlad avatar Aug 17 '17 18:08 dinvlad

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

vance avatar Aug 17 '17 18:08 vance

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.

hccampos avatar Aug 18 '17 17:08 hccampos

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.

harrisonccole avatar Aug 18 '17 17:08 harrisonccole

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.

filipesilva avatar Aug 24 '17 11:08 filipesilva

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

filipesilva avatar Aug 24 '17 11:08 filipesilva

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

On Thu, Aug 17, 2017 at 11:20 AM Denis Loginov [email protected] 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/

vance avatar Oct 31 '17 03:10 vance

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.

filipesilva avatar Oct 01 '19 15:10 filipesilva

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.