Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

138
Visualizações
Very high memory consumption while building multiple vue apps with vue-loader

We are using vue-loader (usually together with the html-webpack-plugin, but I omit this in the following because it is not the important part) to transpile multiple vue based applications within a single project. Our webpack configuration looks a little bit like the following:

const apps = [
  { html: 'app-1', js: 'app-1' },
  { html: 'app-2', js: 'app-2' },
  ...
]

module.exports = (_a, _b) =>({
  entry: Object.fromEntries(apps.map(app => [app.js, './src/${app.js}.js'])),
  ...
  plugins: [
    new VueLoaderPlugin()
  ],
  ...
})

So for instance, app-1.html has a div with id app, which is referenced in app-1.js:

import Vue from 'vue'
import App1 from './app-1.vue'
...
new Vue({...}).$mount('#app')

This means our directory structure (very simplified) looks like the following:

  • src
    • app-1.html
    • app-1.js
    • app-1.vue
    • app-2.html
    • app-2.js
    • app-2.vue
    • ...
  • package.json
  • webpack.config.js

Now here is our problem: We noticed a very high memory consumption, which increases drastically the more apps we have in our apps array. This is something like > 10 GB for a project containing 8 of these apps.

Could this be something like a memory leak in the vue-loader or are we somehow misusing the plugin? We are using version 15.10.0 of vue-loader.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

It seems that vue-loader was not the culprit. I can reproduce the same high memory consumption when I remove the vue-loader completely and don't use any plugins at all. It seems that the terser plugin (which is automatically used by webpack) is the one using up that much memory (see also https://github.com/webpack/webpack/issues/13550). By default terser spawns a lot of threads. One can control this behaviour:

const TerserPlugin = require("terser-webpack-plugin")
...

module.exports = {
    ...
    optimization: {
        minimize: true,
        minimizer: [
            new TerserPlugin({
                parallel: 2,
            })
        ]
    }
}

Alternative solution would be to use another minimizer, e.g. esbuild-loader.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda