Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用CLI TS 增量编译微信小程序报错 #5061

Closed
qw81641493 opened this issue Jul 25, 2024 · 2 comments
Closed

使用CLI TS 增量编译微信小程序报错 #5061

qw81641493 opened this issue Jul 25, 2024 · 2 comments
Assignees
Labels
app bug Something isn't working uni 工程问题 uni 工程安装

Comments

@qw81641493
Copy link

qw81641493 commented Jul 25, 2024

使用CLI +TS
"@dcloudio/vite-plugin-uni": "3.0.0-4020420240722002"
使用该版本 增量编译微信小程序时 提示如下:
开始差量编译...
[plugin:commonjs] Transform failed with 1 error:
D:/dev/my-vue3-project/src/App.vue?vue&type=script&setup=true&lang.ts:1:8: ERROR: Expected ">" but found "setup"
at App.vue:1:8

Expected ">" but found "setup"
1 | <script setup lang="ts">
| ^
2 | import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
3 | onLaunch(() => {

使用 "@dcloudio/vite-plugin-uni": "3.0.0-4000820240401001" 则正常编译

使用官网文档中的 npx degit dcloudio/uni-preset-vue#vite-ts my-vue3-project 创建项目即可复现

@bfc846958672 bfc846958672 added bug Something isn't working app uni 工程问题 uni 工程安装 labels Jul 25, 2024
@fxy060608 fxy060608 self-assigned this Jul 25, 2024
@fxy060608
Copy link
Collaborator

经排查是@vitejs/[email protected]最新版本引发的兼容性问题,临时解决方案,可以根据自己使用的包管理工具,来锁定内部依赖@vitejs/plugin-vue版本为5.0.4,比如 yarn 的话,通过package.json中配置

  "resolutions": {
    "@vitejs/plugin-vue": "5.0.4"
  }

fxy060608 added a commit that referenced this issue Jul 25, 2024
@qw81641493
Copy link
Author

@fxy060608 非常感谢您的帮助~ 问题已通过您的办法解决

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app bug Something isn't working uni 工程问题 uni 工程安装
Projects
None yet
Development

No branches or pull requests

3 participants