0

I am currently working on a Vue.js project with a pretty large codebase. It is written on Vue 2. What I have noticed is that when I run it on development mode using vue-cli-service serve, it uses >2GB of RAM. I have tried a few configs trying to improve this , such as:

configureWebpack: {
optimization: {
  removeAvailableModules: false,
  removeEmptyChunks: false,
  splitChunks: false,
  runtimeChunk: true,
},
output: {
  pathinfo: false,
}

but it didn't change anything. It still uses >2GB of RAM. I also have disabled devtools: Vue.config.devtools = false but still, without luck.

I need to find a way to reduce the RAM usage on development mode.

kissu
  • 40,416
  • 14
  • 65
  • 133
Y G
  • 13
  • 4
  • 1
    Vue doesn't use any specific amount of RAM, it's UI framework. It's Vue CLI you ask about. And this totally depends on your app. – Estus Flask Oct 18 '22 at 08:56
  • It's not Vue *per-se*. I believe it's your IDE, making sense of the code. I bet it would consume a similar amount of RAM if you had an Angular, React or Vanilla JS project, given the same size. In fact, I believe Vue's layer is quite light and doesn't add much to memory consumption, on top of what your project's code needs. Last, but not least, memory consumption is frequently influenced by third party libraries you use. To make a comparison, try spinning an empty Vue and see what the difference is. Anyway, to your point, there's nothing you can do to reduce memory consumption, AFAIK. – tao Oct 18 '22 at 08:56
  • 1
    One thing I'd try would be to move from `@vue/cli` to `vite`. That might have an impact. – tao Oct 18 '22 at 08:58

1 Answers1

2

A lot of things can impact your local dev experience. Listing all of them would take a huge amount of time but you can get a glimpse on what could be optimized here.
That answer is specific to Nuxt but give some generic leads too.

TLDR being that it can depend of your project (importing huge libraries, loading 3rd party scripts, etc...), the tooling around (code editors, linters etc...), your system's specs (SSD, CPU etc...).
It's too broad of a topic to say what exactly is taking you more RAM (and not really worth the effort).

As mentioned in the comments, moving to Vite may help. Get some hardware with 16 GB of RAM, a decent CPU and an SSD and you will be mostly okay if not running crazy unoptimized Docker funky setups.

kissu
  • 40,416
  • 14
  • 65
  • 133