vue 热更新内存溢出
就是保存时会出错
> node –max_old_space_size=4096 webpack-dev-server --inline --progress --config build/webpack.dev.conf.js module.js:549 throw err; ^ Error: Cannot find module 'F:\work\路径\路径\vue\–max_old_space_size=4096' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:188:16) at bootstrap_node.js:609:3 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! house-vue@1.0.0 dev: `node –max_old_space_size=4096 webpack-dev-server --inline --progress --config build/webpack.dev.conf.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the house-vue@1.0.0 dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! D:\Program Files\nodejs\X64\node_cache\_logs\2018-09-04T07_52_06_975Z-debug.log
解决方法:
windows 下的 vue 项目可以找到以下路径
./node_modules/.bin/webpack-dev-server.cmd
添加 --max-old-space-size=4096
@IF EXIST "%~dp0\node.exe" ( "%~dp0\node.exe" "%~dp0\..\webpack-dev-server\bin\webpack-dev-server.js" %* ) ELSE ( @SETLOCAL @SET PATHEXT=%PATHEXT:;.JS;=;% node --max-old-space-size=4096 "%~dp0\..\webpack-dev-server\bin\webpack-dev-server.js" %* )