我的初始安装版本是 0.12.7
在使用vite3+vue3+js的项目中,使用unplugin-vue-define-options插件时,在vue文件中使用defineOptions时报错提示:
Internal server error: unplugin-vue-define-options TypeError: Cannot read properties of undefined (reading 'scriptSetupAst')
我都按照官方引入使用的,但是提示没有这个无法使用。
百度都没查到问题,最后在github上看到有人也遇到同样问题
https://github.com/sxzz/unplugin-vue-macros/issues/203
解决办法:
降低插件版本到 0.12.2
安装命令:
pnpm i unplugin-vue-define-options@0.12.2 -D
最好先删除依赖再pnpm i 之后运行此命令,我试了两次才成功。