Skip to content

🐛 BUG: Error: No such module "node:constants" #8245

@timkelty

Description

@timkelty

Which Cloudflare product(s) does this pertain to?

Workers Vitest Integration

What versions are you using?

@cloudflare/vitest-pool-workers 0.6.16

What operating system and version are you using?

Mac 15.3.1 (24D70)

Please provide a link to a minimal reproduction

https://github.com/timkelty/cloudflare-workers-node-constants

Describe the Bug

When running tests, importing a dependency that imports from constants (example) will result in:

FAIL test/index.spec.ts [ test/index.spec.ts ]
Error: No such module "node:constants".
❯ Users/timkelty/Desktop/node-constants/node_modules/http-message-signatures/lib/algorithm/index.js?mf_vitest_no_cjs_esm_shim:5:21
❯ Users/timkelty/Desktop/node-constants/node_modules/http-message-signatures/lib/index.js?mf_vitest_no_cjs_esm_shim:30:14

  • I've tried Depency pre-building without any luck
  • This only happens during vitest, wrangler deploy works fine.

Please provide any relevant error logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting Cloudflare responseAwaiting response from workers-sdk maintainer teambugSomething that isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions