【Vue3】cannot be compiled under ‘–isolatedModules’ because it is considered a global script file. Add an import, export, or an empty ‘export {}’ statement to make it a module.
文章目录
问题
在Vue3中使用setup语法糖时,当定义一个变量的时候报错了,翻译过来就是Typescript将没有导入/导出的文件视为旧脚本文件而这样的文件不是模块,它们的任何定义都已合并到全局空间中

解决办法

总结
以上就是今天要讲的内容,希望对大家有所帮助!!!
Vue3 TypeScript报错解决:隔离模块编译问题
在Vue3中使用setup语法糖时遇到Typescript编译错误,提示不能在孤立模块下编译全局脚本文件。解决方法是在文件中添加import, export或者空的export{}
8276

被折叠的 条评论
为什么被折叠?



