1.5.0 • Published 3 days ago

@codeages/webpack-vue3 v1.5.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 days ago

package.json

对无关配置进行了省略

{
    "scripts": {
        "serve": "cross-env NODE_ENV=development nodemon --max_old_space_size=4096 node_modules/@codeages/webpack-vue3/dist/webpack.dev.js",
        "build": "node --max_old_space_size=4096 node_modules/@codeages/webpack-vue3/dist/webpack.prod.js",
    }
}

实时编译

实体编译,用于开发模式下,在对前端模块代码修改后,能实时编译生效。

启动实时编译服务:

npm run serve

启动服务后,默认会在本地启动3002端口的前端模块实时编译服务。

编译实体文件

编译实体文体:

npm run build

常见错误

模块不存在

错误提示:

ERROR in multi ....
    Module not found: Error: Cannot resolve 'file' or 'directory' 

解决办法:

rm -rf node_modules
yarn

app crashed

错误提示:

[nodemon] app crashed - waiting for file changes before starting...

解决办法:

在控制台(终端)里输入rs,然后回车。

内存泄漏

错误提示:

<--- Last few GCs --->

      14 ms: Mark-sweep 2.2 (37.1) -> 2.1 (38.1) MB, 2.8 / 0 ms [allocation failure] [GC in old space requested].
      15 ms: Mark-sweep 2.1 (38.1) -> 2.1 (39.1) MB, 1.2 / 0 ms [allocation failure] [GC in old space requested].
      16 ms: Mark-sweep 2.1 (39.1) -> 2.1 (39.1) MB, 0.9 / 0 ms [last resort gc].
      17 ms: Mark-sweep 2.1 (39.1) -> 2.1 (39.1) MB, 1.0 / 0 ms [last resort gc].
...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

解决办法:

重新执行命令:npm run devnpm run compile

端口被占用

events.js:154
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE 0.0.0.0:3002
    at Object.exports._errnoException (util.js:893:11)
    at exports._exceptionWithHostPort (util.js:916:20)
    at Server.__dirname.Server.Server._listen2 (net.js:1246:14)
    ....

解决方法:该错误表明你已经开启了一个端口号为3030的服务,需要先把那个服务关掉。

lsof -i:3002
kill -9 xxxxx(PID编号)

系统默认最大文件打开数过少

报错信息:

watch ...  ENOSPC

解决方法: 在控制台输入

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p