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

[Bug Report] vant-cli TS 打包报错:type of '__vue_sfc__' cannot be named without a reference #12803

Open
LomyCool opened this issue Apr 18, 2024 · 0 comments

Comments

@LomyCool
Copy link

重现链接

https://codesandbox.io/p/github/LomyCool/test-css-bind/main?file=%2Fpackage.json&workspaceId=b692d5d9-9349-485b-b45a-aff272de85c1

Vant 版本

"@vant/cli": "^7.0.1",

描述一下你遇到的问题。

当定义了props变量,打包时会报错:
error TS2742: The inferred type of 'vue_sfc' cannot be named without a reference to '.pnpm/@VUE+shared@3.4.21/node_modules/@vue/shared'. This is likely not portable. A type annotation is necessary.
`<script setup lang="ts">
import { computed } from 'vue';
defineOptions({ name: 'DemoButton' })

//当定义了props变量,打包时会报错,
const props = defineProps({
width: {
type: String,
default: '100px'
},
})
// const width = 100px
const height = 100px
const calcWidth = computed(() => {
return props.width
})
</script>`
图片

重现步骤

1.封装组件,使用TS+setup ;定义一个props
const props = defineProps({
width: {
type: String,
default: '100px'
},
})
2.打包

设备/浏览器

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant