RJ
RJ13mo ago

`Cannot find module 'rollup/parseAst' or its corresponding type declarations.`

I just upgraded from Convex 1.5.1 to 1.6.3 and I'm now getting the following error when running convex dev:
✖ TypeScript typecheck via `tsc` failed.
To ignore failing typecheck, use `--typecheck=disable`.
- Collecting TypeScript errors

node_modules/vite/dist/node/index.d.ts:6:41 - error TS2307: Cannot find module 'rollup/parseAst' or its corresponding type declarations.

6 export { parseAst, parseAstAsync } from 'rollup/parseAst';
~~~~~~~~~~~~~~~~~

Found 1 error in node_modules/vite/dist/node/index.d.ts:6
✖ TypeScript typecheck via `tsc` failed.
To ignore failing typecheck, use `--typecheck=disable`.
- Collecting TypeScript errors

node_modules/vite/dist/node/index.d.ts:6:41 - error TS2307: Cannot find module 'rollup/parseAst' or its corresponding type declarations.

6 export { parseAst, parseAstAsync } from 'rollup/parseAst';
~~~~~~~~~~~~~~~~~

Found 1 error in node_modules/vite/dist/node/index.d.ts:6
Any clue why this might be/how to resolve it?
8 Replies
ballingt
ballingt13mo ago
looks like this is the Convex typecheck trying to find rollup. I wonder why it wants this. Is this the only change? I'll look through our changes. Would you try - doing a push skipping the typecheck: does that work? - running npx tsc --project convex --explainFiles and looking how Vite gets in here hm I dont' see anything that I can imagine affecting this
RJ
RJOP13mo ago
Pushing without typechecking appears to succeed
ballingt
ballingt13mo ago
@RJ Did you upgrade Vite at the same time? I see https://github.com/vitejs/vite/issues/15112 of the three suggested fixes, I know skipLibCheck: true in the convex/tsconfig.json would work. moduleResolution: 'bundler' is the "right" one to use I think, but it would be a bigger change.
RJ
RJOP13mo ago
Hmm, vite isn't a direct dependency of my project, but I had also updated Remix from 2.3.x to 2.4.0, and I know they have integration with Vite as beta feature in v2, so perhaps that also led to Vite being upgraded? (as a dependency of Remix)
ballingt
ballingt13mo ago
hm I see Support Vite 5 (#7846) in Remix 2.3, nothing quite sounds relevant in 2.4 if node_modules/vite/package.json says 5 this sounds lke this issue, we see enough libraries that suggest skipLibCheck: true as the workaround that we don't rely on it working correctly
RJ
RJOP13mo ago
npm why vite produces:
vite@5.0.8 dev
node_modules/vite
peerOptional vite@"^5.0.0" from @remix-run/dev@2.4.0
node_modules/@remix-run/dev
dev @remix-run/dev@"2.4.0" from the root project
vite@"^3.1.0 || ^4.0.0 || ^5.0.0-0" from vitest@0.34.6
node_modules/vitest
dev vitest@"0.34.6" from the root project
vite@"^3.0.0 || ^4.0.0 || ^5.0.0-0" from vite-node@0.34.6
node_modules/vitest/node_modules/vite-node
vite-node@"0.34.6" from vitest@0.34.6
node_modules/vitest
dev vitest@"0.34.6" from the root project

vite@4.5.1 dev
node_modules/vite-node/node_modules/vite
vite@"^3.0.0 || ^4.0.0" from vite-node@0.28.5
node_modules/vite-node
vite-node@"^0.28.5" from @vanilla-extract/integration@6.2.2
node_modules/@vanilla-extract/integration
@vanilla-extract/integration@"^6.2.0" from @remix-run/dev@2.4.0
node_modules/@remix-run/dev
dev @remix-run/dev@"2.4.0" from the root project

vite@4.5.1 dev
node_modules/@vanilla-extract/integration/node_modules/vite
vite@"^4.1.4" from @vanilla-extract/integration@6.2.2
node_modules/@vanilla-extract/integration
@vanilla-extract/integration@"^6.2.0" from @remix-run/dev@2.4.0
node_modules/@remix-run/dev
dev @remix-run/dev@"2.4.0" from the root project
vite@5.0.8 dev
node_modules/vite
peerOptional vite@"^5.0.0" from @remix-run/dev@2.4.0
node_modules/@remix-run/dev
dev @remix-run/dev@"2.4.0" from the root project
vite@"^3.1.0 || ^4.0.0 || ^5.0.0-0" from vitest@0.34.6
node_modules/vitest
dev vitest@"0.34.6" from the root project
vite@"^3.0.0 || ^4.0.0 || ^5.0.0-0" from vite-node@0.34.6
node_modules/vitest/node_modules/vite-node
vite-node@"0.34.6" from vitest@0.34.6
node_modules/vitest
dev vitest@"0.34.6" from the root project

vite@4.5.1 dev
node_modules/vite-node/node_modules/vite
vite@"^3.0.0 || ^4.0.0" from vite-node@0.28.5
node_modules/vite-node
vite-node@"^0.28.5" from @vanilla-extract/integration@6.2.2
node_modules/@vanilla-extract/integration
@vanilla-extract/integration@"^6.2.0" from @remix-run/dev@2.4.0
node_modules/@remix-run/dev
dev @remix-run/dev@"2.4.0" from the root project

vite@4.5.1 dev
node_modules/@vanilla-extract/integration/node_modules/vite
vite@"^4.1.4" from @vanilla-extract/integration@6.2.2
node_modules/@vanilla-extract/integration
@vanilla-extract/integration@"^6.2.0" from @remix-run/dev@2.4.0
node_modules/@remix-run/dev
dev @remix-run/dev@"2.4.0" from the root project
Setting "moduleResolution: "Bundler" in my Convex tsconfig.json seems to work fine 🤷‍♂️ Is there any reason I shouldn't go with that?
ballingt
ballingt13mo ago
That's great, that's we'd like to move to. It's a large change from "moduleResolution": "node" because it means now TypeScript actually uses exports field in package.json to locate types when traversing dependencies, so it's possible one of your other dependencies would have this broken.
RJ
RJOP13mo ago
Ah, I see! Good thing I only allow the finest dependencies into my Convex codebase 🥂 But anyways glad that works, thanks for your help @ballingt!