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

"type": "module" with rollupTypes: true results in error #345

Closed
3 tasks done
christopherjbaker opened this issue Jun 27, 2024 · 1 comment
Closed
3 tasks done

"type": "module" with rollupTypes: true results in error #345

christopherjbaker opened this issue Jun 27, 2024 · 1 comment

Comments

@christopherjbaker
Copy link

Describe the bug

If my package.json has "type": "module" and my dts plugin config has rollupTypes: true, I get the error Internal Error: getResolvedModule() could not resolve module name "./src/main".

I believe this is because module packages must use file extensions. If I comment out the line that removes .d.ts from the generated imports, it builds as expected.

Reproduction

https://stackblitz.com/edit/vitejs-vite-hq4tq1

Steps to reproduce

npm run build

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    vite: ^5.3.1 => 5.3.1 
    vite-plugin-dts: ^3.9.1 => 3.9.1

Validations

@elVengador
Copy link

elVengador commented Jul 28, 2024

I've solved updating the path of my tsconfig in dts into vite.config.ts

dts({
      include: ["./src/lib"],
      tsconfigPath: "./tsconfig.app.json",
    }),

@qmhc qmhc closed this as completed in e080ce5 Jul 30, 2024
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

2 participants