Skip to content

Generated declaration file has incorrect imports #943

@lachlancollins

Description

@lachlancollins

Hi there, thanks for creating such an incredible package! I've been trying to setup tsup in the TanStack Query alpha branch, and seem to have an issue generating .d.ts files - I've just been falling back to tsc (not ideal, especially with the 7.1.0 improvement for ESM/CJS).

In particular, I'm having issues configuring @tanstack/eslint-plugin-query.

tsup.config.js

export default defineConfig({
  entry: ['src/index.ts'],
  format: ['cjs', 'esm'],
  target: ['es2020', 'node16'],
  outDir: 'build/lib',
  external: [/eslint/],
  dts: true, // Add this to generate the code below
  sourcemap: true,
  clean: true,
})

After running pnpm run build:tsup with dts enabled in config:

build/lib/index.d.ts

export { configs } from './configs/index.ts';
export { rules } from './rules/index.ts';

For some reason, it is outputting relative links to .ts files which don't exist in the build directory. I wonder if this is something to do with the entry field? Any help would be much appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions