Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase performance when building Vue webapp?

Tags:

build

vue.js

When I build my Vue project for production, it usually takes a few minutes of processing, even when using a powerfull workstation ... I think this may be due to the default hardware limitation of 1 worker and 2GB memory as shown by the log below :

$ vue-cli-service build
Building for production...Starting type checking service...
Using 1 worker with 2048MB memory limit
\  Building for production...

Would the build process be faster if this limit was increased ? If yes, how can I change it ?

like image 797
sylvelk Avatar asked Jan 01 '23 00:01

sylvelk


1 Answers

The build process taking minutes seems really high. There could be a number of reasons for that.

Specific to your question related to the memory limit, that's just for type checker. Vue uses fork-ts-checker-webpack-plugin to pull out the type checking into a separate process to speed up the build. If that is the main cause of slow build, then indeed playing with the memory limit and workers may help.

Somebody already answered how to do that in this SO post.

That only answers how to change the memory limit.

But you can change the number of workers in the same way. E.g.

forkTsCheckerOptions.workers = 4;
like image 122
Prashant Avatar answered Jan 09 '23 03:01

Prashant