We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
1、模块解析错误: 当我在 vite.config.js 中设置 rollupTypes: true 时,Vite 报错 [vite:dts] Internal Error: getResolvedModule() could not resolve module name "../types/axios.d"。 2、类型声明文件未包含在构建输出中: 当我同时设置 rollupTypes: true 和 copyDtsFiles: true 时,我发现 types/axios.d.ts 文件的内容并没有出现在构建输出目录 dist 中的 index.d.ts 文件里。 3、目录规划问题: 如果只设置 copyDtsFiles: true,虽然可以将类型声明文件复制到构建输出目录,但这并不符合我后期库的多入口文件目录规划。
/
types/axios.d.ts
import 'axios' declare module 'axios' { isNeedToken?: boolean } export * from 'axios'
src/index.ts
const test=()=>{} export * from '../types/axios.d' export default test
vite.config.js
import { defineConfig } from 'vite' import { resolve } from 'path' import dts from 'vite-plugin-dts' export default defineConfig({ plugins: [ dts({ tsconfigPath: resolve(__dirname, 'tsconfig.json'), rollupTypes: true, copyDtsFiles: true, }), ], build: { lib: { entry: resolve(__dirname, 'src/index.ts'), name: 'MyLibrary', formats: ['es', 'cjs', 'umd', 'iife'], exports: 'named', fileName: (format) => `index.${format}.js`, }, }, })
vite 5.1.18 vite-plugin-dts 3.7.3 typescript 5.6.2
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
1、模块解析错误:
当我在 vite.config.js 中设置 rollupTypes: true 时,Vite 报错 [vite:dts] Internal Error: getResolvedModule() could not resolve module name "../types/axios.d"。
2、类型声明文件未包含在构建输出中:
当我同时设置 rollupTypes: true 和 copyDtsFiles: true 时,我发现 types/axios.d.ts 文件的内容并没有出现在构建输出目录 dist 中的 index.d.ts 文件里。
3、目录规划问题:
如果只设置 copyDtsFiles: true,虽然可以将类型声明文件复制到构建输出目录,但这并不符合我后期库的多入口文件目录规划。
Reproduction
/
Steps to reproduce
types/axios.d.ts
src/index.ts
vite.config.js
System Info
Validations
The text was updated successfully, but these errors were encountered: