[Bug Report] vant-cli TS 打包报错:type of '__vue_sfc__' cannot be named without a reference
LomyCool opened this issue · comments
重现链接
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