Skip to content

Rollup dts compilation error with @tanstack/react-table in Next.js 15 (with. Turborepo) #5899

@skulter

Description

@skulter

Discussed in #5897

Originally posted by skulter January 31, 2025
Hello,

I am encountering an issue when compiling my UI component package using Rollup in a Turborepo monorepo setup.

I am using Next.js 15 and compiling the UI package located in packages/ui with Rollup. The basic compilation works fine, but when using rollup-plugin-dts, I get an error related to @tanstack/react-table, stating that the type definitions cannot be found.

Below is the relevant part of my rollup.config.js:

{
  input: 'src/index.ts',
  output: {
    file: 'dist/index.d.ts',
    format: 'esm',
  },
  plugins: [
    dts({
      respectExternal: true,
      compilerOptions: {
        preserveSymlinks: true,
      },
    }),
    external(),
  ],
  external: ['react', 'react-dom'],
}

Here is my tsconfig.json:

"compilerOptions": {
  "target": "ES6",
  "module": "ESNext",
  "moduleResolution": "Bundler",
  "outDir": "./dist",
  "rootDir": ".",
  "esModuleInterop": true,
  "forceConsistentCasingInFileNames": true,
  "strict": true,
  "skipLibCheck": true,
  "baseUrl": ".",
  "noEmit": true,
  "declaration": true,
  "importHelpers": true,
  "isolatedModules": true,
  "allowJs": true,
  "allowSyntheticDefaultImports": true,
  "declarationDir": "./dist",
  "noFallthroughCasesInSwitch": true,
  "resolveJsonModule": true,
  "jsx": "react-jsx",
  "noImplicitAny": false,
  "paths": {
    "@ui/*": ["@mono/acme-components/*"],
    "@/*": ["./*"],
    "@tanstack/react-table": ["./node_modules/@tanstack/react-table"]
  }
}

I am using @tanstack/react-table@8.19.3.

The error suggests that Rollup dts cannot resolve the types from @tanstack/react-table. Is there a way to properly configure Rollup to resolve these types correctly?

Any guidance would be greatly appreciated.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions