vant icon indicating copy to clipboard operation
vant copied to clipboard

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

Open LomyCool opened this issue 10 months ago • 0 comments

重现链接

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/@[email protected]/node_modules/@vue/shared'. This is likely not portable. A type annotation is necessary. `

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

重现步骤

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

设备/浏览器

No response

LomyCool avatar Apr 18 '24 10:04 LomyCool