1.场景
运行项目时,out of memory,内存溢出。导致前端运行需要重启项目。
2.解决
2.1删除缓存
删除依赖包中的cacle临时缓存
2.2 更改项目配置
"scripts": {
"serve": "node --max_old_space_size=5120 node_modules/@vue/cli-service/bin/vue-cli-service.js serve --mode development",
"serve:test": "node --max_old_space_size=5120 node_modules/@vue/cli-service/bin/vue-cli-service.js serve --mode test",
"serve:preview": "node --max_old_space_size=5120 node_modules/@vue/cli-service/bin/vue-cli-service.js serve --mode preview",
"build": "node --max_old_space_size=5120 node_modules/@vue/cli-service/bin/vue-cli-service.js build --mode test",
"build:preview": "node --max_old_space_size=5120 node_modules/@vue/cli-service/bin/vue-cli-service.js build --mode preview",
"report": "vue-cli-service build --report",
"lint": "vue-cli-service lint",
"lint:nofix": "vue-cli-service lint --no-fix",
"test:unit": "vue-cli-service test:unit",
"postinstall": "opencollective-postinstall"
},
更改数值大小
--max_old_space_size=5120