[plugin:vite:vue] At least one <template> or <script> is required in a single file component.
- 发布:2023-03-18 01:18
- 更新:2024-09-14 21:59
- 阅读:5943
[plugin:vite:vue] At least one <template> or <script> is required in a single file component.
使用Vue3 TS来编写uniapp的项目。编译时出现'At least one <template> or <script> is required in a single file component.'
l***@163.com - 路飞君
解决方法:
必须在返回对象的时候包含{
plugins: [uni()],
...你的配置
}
产生原因:
//必须要plugins: [uni()],,官方要求,不然他会告诉你需要需要引入@vitejs/plugin-vue ,错误信息是port analysis because the content contains invalid JS syntax. Install @vitejs/plugin-vue to handle .vue files.
当你这样引入并使用的时候就会出现
[plugin:vite:vue] At least one <template> or <script> is required in a single file component.
1***@qq.com
同样的问题,注释掉vue()就好了,感谢
2023-12-25 09:42