enter image description hereThe “npm run build” command causes the linux server to jam. The stuck situation is shown in the figure. My server is configured with 2 cores and 2G memory. Every time I run this command, my cpu usage is 100%. Is there any way I can optimize the “npm run build” command, or some other solution, I don’t want to package it locally and upload it to my server because I find it cumbersome.
Thank you to anyone who can help me.
Here is my vue.config.js file。
const path = require('path')
const { defineConfig } = require('@vue/cli-service')
function resolve(dir) {
return path.join(__dirname, dir)
}
module.exports = defineConfig({
transpileDependencies: true,
productionSourceMap: false,
devServer: {
proxy: {
'/api': {
target: 'http://localhost:8310',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
}
},
configureWebpack: {
resolve: {
alias: {
'@': resolve('src')
}
}
},
chainWebpack: (config) => {
config.resolve.alias.set('vue-i18n', 'vue-i18n/dist/vue-i18n.cjs.js')
config.module.rule('svg').exclude.add(resolve('src/icons')).end()
config.module
.rule('icons')
.test(/.svg$/)
.include.add(resolve('src/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
.end()
}
})
I tried to Google the solution, but didn’t find the relevant solution, I hope someone can provide me with a solution to execute “npm run build” on a low configuration server. Thank you.
ZGG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.