网站搜索

reactjs - TSUP 声明文件保持项目结构


我正在尝试使用 TSUP 打包我的 React UI 库。我目前有这个配置。

import type { Options } from 'tsup';

const tsup: Options = {
    splitting: true,
    clean: true,
    dts: true,
    format: ['esm'],
    minify: true,
    bundle: true,
    skipNodeModulesBundle: true,
    target: 'es2020',
    outDir: 'dist',
    entry: ['src/**/*.tsx'],
    esbuildOptions(options) {
        // the directory structure will be the same as the source
        options.outbase = "./";
    },
};

export default tsup

我目前正在将所有的 tsx 文件编译并按项目中的相同结构进行整理。如何才能让 .d.ts 文件与组件位于相同的目录中?