Skip to content
New issue

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

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

Open
skulter opened this issue Feb 3, 2025 · 0 comments

Comments

@skulter
Copy link

skulter commented Feb 3, 2025

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant