1. 程式人生 > >webpack 內存溢出 Allocation failed - JavaScript heap out of memory

webpack 內存溢出 Allocation failed - JavaScript heap out of memory

過多 溢出 path ebp webp clas serve lse -s

項目中,當組件文件過多,webpack-dev-server 編譯時,容易內存溢出,

\node_modules\.bin\webpack-dev-server.cmd 加以下紅色配置,暫可解決

@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe" "--max_old_space_size=4096" "%~dp0\..\[email protected]@webpack-dev-server\bin\webpack-dev-server.js" %*
) ELSE (
  @SETLOCAL
  @SET PATHEXT
=%PATHEXT:;.JS;=;% node "--max_old_space_size=4096" "%~dp0\..\[email protected]@webpack-dev-server\bin\webpack-dev-server.js" %* )

註意空格 和 雙引號

webpack 內存溢出 Allocation failed - JavaScript heap out of memory