vant icon indicating copy to clipboard operation
vant copied to clipboard

vant. cli 7.0.0版本TS开发,build后没有生成lib/index.d.ts文件

Open wukongyang opened this issue 1 year ago • 1 comments

Reproduction Link

Vant Version

7.0.0

Describe the Bug

build 打包后没有生成lib/index.d.ts,只在各个组件的文件夹下生成了index.d.ts文件,导致在使用时,引入组件无法得到类型提示 打包后目录如下 image

tsconfig.declaration.json配置如下

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "declaration": true,
    "declarationDir": ".",
    "emitDeclarationOnly": true // 只发出声明
  },
  "include": ["es/**/*", "lib/**/*"],
  "exclude": ["node_modules", "**/test/**/*", "**/demo/**/*"]
}

tsconfig.json

{
  "compilerOptions": {
    "noImplicitAny": false,
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "declaration": true,  
  },
}

Reproduce Steps

pnpm run build

Device / Browser

No response

wukongyang avatar Aug 07 '24 02:08 wukongyang

顶,我也出现了。请问怎么解决呢

0zcl avatar Jan 22 '25 06:01 0zcl