#5592 Vitest can not import Stripe
Module resolution issues in workerd runtime. Affects Stripe, semver, opentelemetry. Workarounds exist.
Document incompatibilities; improve error messages for module resolution failures
Analysis Report
Issue Review: cloudflare/workers-sdk#5592
Summary
Vitest pool workers crashes when importing the Stripe SDK due to module resolution issues.
Findings
- Created: 2024-04-11
- Updated: 2025-10-30
- Version: wrangler 3.48.0, vitest 1.3.0, vitest-pool-workers 0.1.17 → current
- Component: vitest-pool-workers
- Labels: bug, vitest
- Comments: 5
Key Evidence
- Importing Stripe causes crash: "No such module" errors
- Initially thought related to #5588 but persists after that fix
- Similar issues with other dependencies (semver, @opentelemetry)
- User @gourgouris found workaround: add alias in vitest config to resolve
call-bind/callBound - User @gourgouris has given up on vitest-pool-workers entirely, switched to localhost testing approach
- Related to module resolution issues in workerd runtime
Recommendation
Status: KEEP OPEN
Reasoning: Valid bug affecting popular third-party libraries like Stripe. The module resolution issues are a known limitation of the vitest-pool-workers approach. Workarounds exist (aliases, localhost testing) but the UX is poor. Related to fundamental differences in how workerd handles Node.js modules.
Action: Document known incompatibilities and workarounds. Consider improving error messages when module resolution fails.
Suggested Comment
This issue is related to module resolution in the workerd runtime used by vitest-pool-workers. Some npm packages have Node.js-specific module resolution patterns that don't work in the Workers environment.
Workaround: Add aliases in your vitest config:
alias: { 'call-bind/callBound': new URL('./node_modules/call-bind/index.js', import.meta.url).pathname, }Alternatively, test against a local dev server instead of using vitest-pool-workers for tests involving incompatible packages.
Notes & Feedback (0)
No notes yet.