vbenjs / vite-plugin-mock

A mock plugin for vite.use mockjs.
MIT License
615 stars 96 forks source link

The CJS build of Vite's Node API is deprecated #129

Open VfanLee opened 8 months ago

VfanLee commented 8 months ago

我将项目从 vite 4 升级到了 vite 5,也按照官方更改了我的项目:

  1. vite.config.js 全部改为 ESM 语法
  2. package.json 添加 "type": "module"

运行项目后,仍然提示: The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.

经过排查,发现问题出现在 vite-plugin-mock 上。

虽然不影响功能,但是还是想消除警告,请问该如何解决?

kortin99 commented 8 months ago

image

For more information: https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated