After vue3+vite installs vite-plugin-mock, it reports an error

After vue3+vite installs vite-plugin-mock, it reports an error

Introduce error reporting in vite.config.ts

viteMockServe({ localEnabled: command === 'serve', }),Reported an error after adding in vite.config.ts
insert image description here

run error

Then execute the run command to report an error
insert image description here

Solution

It is related to the version of vite-plugin-mock. After I installed version 2.9.6, no error will be reported. Execute the command as follows

yarn add mockjs vite-plugin-mock@2.9.6 -D

Guess you like

Origin blog.csdn.net/qq_51741730/article/details/131329866