vbenjs / vite-plugin-mock

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

点击提示的位置在if条件内容改为 if (typeof require === "undefined" || !require.cache) #109

Closed songyipan closed 9 months ago

songyipan commented 1 year ago

image

将代码这样改:image 不然运行时会报: image

codepandy commented 1 year ago

我也遇到了,但是发现github上最新的版本是2.9.1,安装2.9.1就行了

wwhwwhwwh commented 1 year ago

删除自己项目根目录下 package.json 中的 这一行,一般默认会有

"type": "module"

声明type:"module", 默认会读取 dist/index.mjs ,删除之后会读取 dist/index.cjs

环境

"vite": "^4.4.9",
"vite-plugin-mock": "^3.0.0"
"node":"v16.14.0"