Nuxt.js: Slow compile speed

Created on 14 Jun 2019  Â·  16Comments  Â·  Source: nuxt/nuxt.js

Version

v2.8.1

Reproduction link

https://github.com/nuxt/create-nuxt-app

Steps to reproduce

yarn create nuxt-app
yarn run build

What is expected ?

Build takes about 12-15 seconds.

What is actually happening?

Build takes 25+ seconds.

Additional comments?

I am really strugling with build times. When I for example try Next.js compilation, it only takes 12 seconds (on the first and 5 seconds after each new build) for the template to compile. Nuxt.js on the other hand takes 25 seconds and more. It takes 2x longer. I dont like it, because deployment of simple two page app takes 4+ minutes on Now.sh. I think that these speeds should be way faster.

I have also one more complicated app and the build takes 10 minutes+. And that is awful.

I have seen some advices how to cache and parallel, but neither of these made significant speed up. (I cant use cache, because it is containerized).

Is there some work towards it or are there any options, how to improve it?

This bug report is available on Nuxt community (#c9364)
bug-report pending-repro stale

All 16 comments

For me a new create-nuxt-app builds in less then 9 seconds, can you share some more details and a reproduction maybe?

My computer (laptop), where I measure speeds, has processor Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz with 12 GB RAM and nvme SSD. My operating system is Pop!_Os (it's a Debian distribution).

I do the test with basic npx create command. I start with the command for Nuxt.js and for Next.js. Then I try to build both apps (NOT at once). The results are consistent that Nuxt.js is 2x slower than Next.js.

For me a new create-nuxt-app builds in less then 9 seconds, can you share some more details and a reproduction maybe?

Please try to build both apps and then compare them. The differences in speed of small applications are same as of large applications. (Which makes the difference from seconds to minutes).

I've looked at a lot of comments and found that a lot of people actually have this problem, but in fact so far there is no effective solution for the official, I hope to optimize, thank you

the build takes 10 minutes+. and that is awful. @dobrac

my build takes 5 minutes+,now

Thanks for your contribution to Nuxt.js!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of nuxt-edge
  2. Comment the steps to reproduce it

Issues that are labeled as pending will not be automatically marked as stale.

A build taking so much time usually indicates either a really large application or problems in the underlying configuration/code base.

However, we are trying to improve the build and HMR time as good as we can. But a large part of it comes through the user-added dependencies

A build taking so much time usually indicates _either_ a really large application or problems in the underlying configuration/code base.

However, we are trying to improve the build and HMR time as good as we can. But a large part of it comes through the user-added dependencies

If it's so, why is it happening in the official Nuxt.js example?

@dobrac Feel free to point out an example that takes longer than 10 minutes to build :relaxed:

As @pimlie said, the default build time is ~9-11 seconds (fresh CNA app)
image

Thanks for your contribution to Nuxt.js!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of nuxt-edge
  2. Comment the steps to reproduce it

Issues that are labeled as pending will not be automatically marked as stale.

Large HTML Dokument > 1000 lines of markup, takes up to minutes compiling! So for large html dokuments nuxt is unusable at the moment.

ℹ Preparing project for development 10:14:17
ℹ Initial build may take a while 10:14:17
✔ Builder initialized 10:14:17
✔ Nuxt files generated 10:14:17

✔ Client
Compiled successfully in 2.25m

ℹ Waiting for file changes 10:16:33
ℹ Memory usage: 399 MB (RSS: 568 MB)

@do-web do you have an example that would reproduce this example? Would be happy to dig in and see what is going on.

Does anyone have a solution to the same problem ?, I only use an old notebook with specifications:

CPU: Intel Atom N270
RAM: 2GB DDR2

NodeJS: v12.11.0
npm: v6.11.3

in the fresh install of create-nuxt-app, I run npm run dev and it takes more than 20 minutes to finish the compiled.

I know the problem is the limitations of the device I am using, but I hope I can get advice so that the process can run fast.

Thank you.

That does seem unnaturally slow. My best advice would be to try on another computer as you are most likely dealing with some sort of hardware issue. We used 2gb of ram with node 8.11.1 on digitalocean and was substantially faster for the built on production mode (which does minificiation and such).

@padri-zan That CPU was already slow when it was new, let alone 11 years later.

If the net/notebook has a hdd, try to see if you can use a ssd/sd card/usb as the cpu is probably also bogged with io-waits. Maybe even try to setup a ram-disk and copy your full project to it and then run it. Make the ram disk as small as possible, ~512MB should be enough hopefully depending on your project but note that ALL files on the ram-disk are lost when you unplug the power. So if you make changes on the ramdisk you have to manually copy them to the real disk as well. Use google to look for howto's of creating a ramdisk for your operating system.

But the best advise is to try to upgrade to a somewhat quicker machine

Yes, I think it is like that, I will try on some services such as Digitalocean, GCP, etc.
which one do you think is worth considering?

Indeed, slow to compile on XPS 15 / Core i7, 12GB RAM: 20 seconds for relatively small website with about 20 pages. Nothing weird going on and no other packages than nuxt provides.

Also seems to be slower while developing, until I get node crash due to running out of heap memory. Will keep a watch of things to see if I can improve reporting...

same here, taking 15-20 seconds to compile

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maicong picture maicong  Â·  3Comments

nassimbenkirane picture nassimbenkirane  Â·  3Comments

msudgh picture msudgh  Â·  3Comments

uptownhr picture uptownhr  Â·  3Comments

o-alexandrov picture o-alexandrov  Â·  3Comments