Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Angular & Core v3.4.0 takes too long to build #3252


User avatar
0
felixbeltran created

Hi,

I'm running the code with npm run hmr

Every time I make a modification to the code the compiler takes too long to refresh. It get stucked for several seconds in step "92% chunk asset optimization". Productivity is really low. Do you have any idea how to make it faster?

Thanks.


16 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Does it work faster when you run with "npm run" ? Also, which version of angular-cli do you use ?

    Thanks.

  • User Avatar
    0
    felixbeltran created

    Hi,

    There is no "npm run" option. I have to use "npm run hmr".

    I'm including an image with the details.

    Thanks.

  • User Avatar
    0
    felixbeltran created

    A little bit of more information. I found that with "devtool" configuration you can increase the rebuild speed. But I cannot find where to set it's value.

    <a class="postlink" href="https://webpack.js.org/configuration/devtool/">https://webpack.js.org/configuration/devtool/</a>

    Thanks, Felix.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Since angular-cli uses webpack internally, we are not allowed to change webpack related stuff. Sorry for my mistake, I was trying to say "npm start" :).

  • User Avatar
    0
    felixbeltran created

    Hi,

    "npm start" does the same thing (takes to long to rebuild).

    So, there is nothing we can do? What about "devtool"? As far as I understand, it's a configuration feature, not a change on webpack.

    Thanks again.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I'm not sure if we can use <a class="postlink" href="https://webpack.js.org/configuration/devtool/">https://webpack.js.org/configuration/devtool/</a> or not, but since you have soure code you can give it a try.

    By the way, which version of AspNet Zero do you use ? We were having same problem at the beginning of angular2 version but then we have fixed it by seperating app to different chunks.

    In our development rebuild takes a few seconds.

    Thanks.

  • User Avatar
    0
    felixbeltran created

    Hi,

    It's version 3.4.0. At the beginning it wasn't taking that long, but as the project size grows, the rebuild time also grows (a lot).

    How did you separated to different chunks?

    I hope you can help me, this is really killing productivity.

    Thanks.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    It seems like we did it in v3.1, so probably you have it. If you don't, I think it is better to search on the net for splitting your app into different chuncks because our commit/work is not going to help you on this.

    Also, I personally applied this solution on my pc <a class="postlink" href="http://www.wrapcode.com/improve-angular-cli-build-speed-windows/">http://www.wrapcode.com/improve-angular ... d-windows/</a>.

    Thanks.

  • User Avatar
    0
    felixbeltran created

    Hi,

    That "fix" relies on disabling window defender and indexer (wich is not my case). It didn't do anything.

    Finally I was able to find where to configure the "devtool" parameter and now rebuild time is really short.

    Regards, Felix.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks for your feedback @felixbeltran.

    Can you share how did you configure it ? It might help others as well.

    Thanks.

  • User Avatar
    0
    llarouche created

    Hello;

    Felix, can you explain where you found the devtool to configure and how you configured it.

    Thanks,

    Dino

  • User Avatar
    0
    alper created
    Support Team

    Thanks for your feedback ;)

  • User Avatar
    0
    manojreddy created

    Hi @felixbeltran,

    Could you please explain devtool configuration solution.

  • User Avatar
    0
    manojreddy created

    @alper @felixbeltran ,

    Could you please explain how?

    Finally I was able to find where to configure the "devtool" parameter and now rebuild time is really short.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can try to add --no-sourcemap option to npm start, see <a class="postlink" href="https://github.com/angular/angular-cli/pull/3113#issue-188781779">https://github.com/angular/angular-cli/ ... -188781779</a>.

    Just open package.json and replace

    "start": "ng serve --host 0.0.0.0 --port 4200"
    

    with

    "start": "ng serve --no-sourcemap --host 0.0.0.0 --port 4200"
    

    Also, try to upgrade your angular-cli version if it is old.

  • User Avatar
    0
    annoure created

    <cite>felixbeltran: </cite> Hi,

    I'm running the code with npm run hmr

    Every time I make a modification to the code the compiler takes too long to refresh. It get stucked for several seconds in step "92% chunk asset optimization". Productivity is really low. Do you have any idea how to make it faster?

    Thanks.

    try with yarn. It's work for me

    yarn run hmr