unplugin-vue-define-options插件问题

unplugin-vue-define-options TypeError: Cannot read properties of undefined (reading 'scriptSetupAst')
报这种错误,降低插件版本到0.12.2也没有用,降低node版本也不行

img

这个错误可能是由于 @vue/compiler-sfc 版本低于 3.2.26 导致的。可以通过升级 @vue/compiler-sfc 来解决这个问题。你可以先执行下面的命令升级 @vue/compiler-sfc
 

npm install -D @vue/compiler-sfc@latest

如果升级后问题仍然存在,你可以尝试重新安装该插件依赖项并重新安装插件,重新构建应用程序来解决问题。具体来说,可以执行以下步骤:

  1. 删除 node_modules 文件夹:
rm -rf node_modules

  1. 清除 npm 缓存:
npm cache clean --force

  1. 重新安装依赖项:
npm install

  1. 重新安装该插件:
npm install -D unplugin-vue-define-options@latest

  1. 重新构建应用程序。

希望这些步骤能够帮助你解决问题😄