question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

production build of angular takes lot of time

See original GitHub issue

I am trying to build my angular project and it takes lots of time(8+ minutes) for building. Below is my docker file. Image is created using Gitlab private runners.

FROM node:alpine as builder
WORKDIR /app
COPY .  /app
RUN cd /app && npm set progress=false && npm install
RUN cd /app && node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build --aot --prod

FROM nginx:alpine
RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /app/dist/fdm-apps /usr/share/nginx/html
COPY nginx/nginx-conf.conf /etc/nginx/nginx.conf
WORKDIR /usr/share/nginx/html

EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

Here is the angular configurations.

"optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "3mb",
                  "maximumError": "5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
              ]

Is there any way to bring down my build time?

Angular CLI: 9.1.6
Node: 12.18.3
OS: darwin x64
Angular: 9.1.9

This is what takes 90% of the time.

Compiling @angular/cdk/keycodes : es2015 as esm2015
Compiling primeng/dom : es2015 as esm2015
Compiling @angular/animations : es2015 as esm2015
Compiling @angular/compiler/testing : es2015 as esm2015
Compiling @angular/core : es2015 as esm2015
Compiling @angular/common : es2015 as esm2015
Compiling @angular/cdk/observers : es2015 as esm2015
Compiling @angular/cdk/collections : es2015 as esm2015
Compiling @angular/animations/browser : es2015 as esm2015
Compiling @angular/core/testing : es2015 as esm2015
Compiling @angular/cdk/platform : es2015 as esm2015
Compiling apollo-angular : es2015 as esm2015
Compiling @angular/cdk/accordion : es2015 as esm2015
Compiling @angular/forms : es2015 as esm2015
Compiling @angular/platform-browser : es2015 as esm2015
Compiling @angular/cdk/portal : es2015 as esm2015
Compiling @angular/cdk/bidi : es2015 as esm2015
Compiling primeng/button : es2015 as esm2015
Compiling @angular/cdk/a11y : es2015 as esm2015
Compiling @angular/common/http : es2015 as esm2015
Compiling primeng/tooltip : es2015 as esm2015
Compiling @angular/platform-browser/animations : es2015 as esm2015
Compiling @angular/cdk/layout : es2015 as esm2015
Compiling @angular/router : es2015 as esm2015
Compiling primeng/inputtext : es2015 as esm2015
Compiling @angular/cdk/scrolling : es2015 as esm2015
Compiling @angular/cdk/text-field : es2015 as esm2015
Compiling @angular/cdk/stepper : es2015 as esm2015
Compiling @angular/cdk/table : es2015 as esm2015
Compiling @angular/cdk/tree : es2015 as esm2015
Compiling @angular/material/core : es2015 as esm2015
Compiling @angular/platform-browser/testing : es2015 as esm2015
Compiling @angular/platform-browser-dynamic : es2015 as esm2015
Compiling primeng/api : es2015 as esm2015
Compiling @angular/common/testing : es2015 as esm2015
Compiling apollo-angular-link-http-common : es2015 as esm2015
Compiling primeng/progressbar : es2015 as esm2015
Compiling @angular/cdk/overlay : es2015 as esm2015
Compiling primeng/focustrap : es2015 as esm2015
Compiling primeng/utils : es2015 as esm2015
Compiling @angular/material/button : es2015 as esm2015
Compiling @angular/material/form-field : es2015 as esm2015
Compiling @angular/material/divider : es2015 as esm2015
Compiling @angular/material/icon : es2015 as esm2015
Compiling @angular/material/sort : es2015 as esm2015
Compiling @angular/material/dialog : es2015 as esm2015
Compiling primeng/dropdown : es2015 as esm2015
Compiling primeng/messages : es2015 as esm2015
Compiling @angular/material/tooltip : es2015 as esm2015
Compiling @angular/animations/browser/testing : es2015 as esm2015
Compiling @angular/cdk/clipboard : es2015 as esm2015
Compiling @angular/material/input : es2015 as esm2015
Compiling @angular/material/select : es2015 as esm2015
Compiling @angular/common/http/testing : es2015 as esm2015
Compiling primeng/paginator : es2015 as esm2015
Compiling @angular/cdk/drag-drop : es2015 as esm2015
Compiling @angular/material/badge : es2015 as esm2015
Compiling @angular/material/autocomplete : es2015 as esm2015
Compiling @angular/material/bottom-sheet : es2015 as esm2015
Compiling @angular/material/card : es2015 as esm2015
Compiling @angular/material/button-toggle : es2015 as esm2015
Compiling @angular/material/checkbox : es2015 as esm2015
Compiling @angular/material/paginator : es2015 as esm2015
Compiling @angular/material/chips : es2015 as esm2015
Compiling @angular/material/expansion : es2015 as esm2015
Compiling @angular/material/icon/testing : es2015 as esm2015
Compiling @angular/material/grid-list : es2015 as esm2015
Compiling @angular/material/datepicker : es2015 as esm2015
Compiling @angular/material/list : es2015 as esm2015
Compiling @angular/material/progress-spinner : es2015 as esm2015
Compiling @angular/material/progress-bar : es2015 as esm2015
Compiling @angular/material/menu : es2015 as esm2015
Compiling @angular/material/radio : es2015 as esm2015
Compiling @angular/material/sidenav : es2015 as esm2015
Compiling @angular/material/slide-toggle : es2015 as esm2015
Compiling @angular/material/slider : es2015 as esm2015
Compiling @angular/material/snack-bar : es2015 as esm2015
Compiling @angular/material/toolbar : es2015 as esm2015
Compiling @angular/material/stepper : es2015 as esm2015
Compiling @angular/material/table : es2015 as esm2015
Compiling @angular/material/tabs : es2015 as esm2015
Compiling @angular/platform-browser-dynamic/testing : es2015 as esm2015
Compiling @angular/material/tree : es2015 as esm2015
Compiling @angular/router/testing : es2015 as esm2015
Compiling ng2-ckeditor : es2015 as esm2015
Compiling ng2-codemirror : main as commonjs
Compiling ngx-color-picker : es2015 as esm2015
Compiling ngx-cron-jobs : es2015 as esm2015
Compiling primeng/accordion : es2015 as esm2015
Compiling apollo-angular-link-http : es2015 as esm2015
Compiling apollo-angular/testing : es2015 as esm2015
Compiling @clr/angular : es2015 as esm2015
Compiling primeng/blockui : es2015 as esm2015
Compiling primeng/autocomplete : es2015 as esm2015
Compiling primeng/captcha : es2015 as esm2015
Compiling primeng/breadcrumb : es2015 as esm2015
Compiling primeng/calendar : es2015 as esm2015
Compiling primeng/card : es2015 as esm2015
Compiling primeng/carousel : es2015 as esm2015
Compiling primeng/checkbox : es2015 as esm2015
Compiling primeng/codehighlighter : es2015 as esm2015
Compiling primeng/chips : es2015 as esm2015
Compiling primeng/contextmenu : es2015 as esm2015
Compiling primeng/confirmdialog : es2015 as esm2015
Compiling primeng/colorpicker : es2015 as esm2015
Compiling primeng/dataview : es2015 as esm2015
Compiling primeng/defer : es2015 as esm2015
Compiling primeng/dragdrop : es2015 as esm2015
Compiling primeng/dialog : es2015 as esm2015
Compiling primeng/dynamicdialog : es2015 as esm2015
Compiling primeng/fieldset : es2015 as esm2015
Compiling primeng/editor : es2015 as esm2015
Compiling primeng/fileupload : es2015 as esm2015
Compiling primeng/galleria : es2015 as esm2015
Compiling primeng/inplace : es2015 as esm2015
Compiling primeng/gmap : es2015 as esm2015
Compiling primeng/inputmask : es2015 as esm2015
Compiling primeng/inputswitch : es2015 as esm2015
Compiling primeng/inputtextarea : es2015 as esm2015
Compiling primeng/keyfilter : es2015 as esm2015
Compiling primeng/lightbox : es2015 as esm2015
Compiling primeng/listbox : es2015 as esm2015
Compiling primeng/megamenu : es2015 as esm2015
Compiling primeng/message : es2015 as esm2015
Compiling primeng/menu : es2015 as esm2015
Compiling primeng/menubar : es2015 as esm2015
Compiling primeng/orderlist : es2015 as esm2015
Compiling primeng/organizationchart : es2015 as esm2015
Compiling primeng/multiselect : es2015 as esm2015
Compiling primeng/overlaypanel : es2015 as esm2015
Compiling primeng/panelmenu : es2015 as esm2015
Compiling primeng/progressspinner : es2015 as esm2015
Compiling primeng/panel : es2015 as esm2015
Compiling primeng/picklist : es2015 as esm2015
Compiling primeng/password : es2015 as esm2015
Compiling primeng/radiobutton : es2015 as esm2015
Compiling primeng/rating : es2015 as esm2015
Compiling primeng/scrollpanel : es2015 as esm2015
Compiling primeng/sidebar : es2015 as esm2015
Compiling primeng/selectbutton : es2015 as esm2015
Compiling primeng/slider : es2015 as esm2015
Compiling primeng/slidemenu : es2015 as esm2015
Compiling primeng/spinner : es2015 as esm2015
Compiling primeng/steps : es2015 as esm2015
Compiling primeng/splitbutton : es2015 as esm2015
Compiling primeng/tabview : es2015 as esm2015
Compiling primeng/tabmenu : es2015 as esm2015
Compiling primeng/terminal : es2015 as esm2015
Compiling primeng/table : es2015 as esm2015
Compiling primeng/togglebutton : es2015 as esm2015
Compiling primeng/tieredmenu : es2015 as esm2015
Compiling primeng/toast : es2015 as esm2015
Compiling primeng/toolbar : es2015 as esm2015
Compiling primeng/tristatecheckbox : es2015 as esm2015
Compiling primeng/treetable : es2015 as esm2015
Compiling primeng/tree : es2015 as esm2015
Compiling primeng/virtualscroller : es2015 as esm2015
Generating ES5 bundles for differential loading...

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
devel112commented, Aug 13, 2020

This is a pain for many angular devs i think. Accumulated dev hours wasted etc. etc… Please put this on top feature priority 😥

0reactions
angular-automatic-lock-bot[bot]commented, Oct 18, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to speed up the Angular build process - Stack Overflow
After making some changes in my TypeScript files, each build takes over 20 minutes. I run this command: ng build --output-path=.. \.. \static\ ......
Read more >
ng serve and ng build is very slow #42100 - GitHub
Now everything is very slow. Even recompiling simple text changes take much time. Deploy to production is extreme slow.
Read more >
How to speed up Angular build times with caching - Medium
Drastically speed up your Angular build times by saving your ng build and jest caches. Up to a 75% percent decrease in build...
Read more >
Make Your Build Faster in Angular v12 | by Netanel Basal
I was curious to see how much time it'll save and benchmarked it on a new Angular project: Subsequent builds were twice as...
Read more >
Improving Angular initial load time - DEV Community ‍ ‍
If you are working on a large codebase, chances are that you have a lot of modules, and your main bundle might be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found