jakearchibald / idb

IndexedDB, but with promises
https://www.npmjs.com/package/idb
ISC License
6.22k stars 348 forks source link

Vite SSR: Cannot find module './build/cjs/index.js' #260

Closed bogacg closed 2 years ago

bogacg commented 2 years ago

I've been playing with idb in a SvelteKit project and I'm getting this error when I hit the page with SSR.

Steps to reproduce

At this point we get error:

[vite] Error when evaluating SSR module /src/routes/todos/index.svelte:
Error: Cannot find module './build/cjs/index.js'
Require stack:
- ...\idb-test-app\node_modules\idb\with-async-ittr.cjs

I've been trying to implement recommendations as described in SvelteKit FAQ with no luck so far.

Update: If I don't hit the page directly (opening root then click its link) I still see the error on CLI side but code seems to work fine.

jakearchibald commented 2 years ago

Ah yes, I see the issue. Thanks for the report.

jakearchibald commented 2 years ago

Published the fix as 7.0.1