π BUG: "Module cannot be synchronously ...
Hello! π I'm currently trying to migrate our test suite to Vite + the new pool workers, and I have run into this issue while doing so: https://github.com/cloudflare/workers-sdk/issues/5367 βΒ is this a known issue? Any recommendations?
3 Replies
Hey! π Unfortunately, the Workers Vitest integration doesn't support modules with cyclic
require()
s. This is a known issue which we currently don't have a good workaround for. I'd encourage you to use a library which supports Workers natively such as jose
(https://github.com/panva/jose) instead of jsonwebtoken
.GitHub
GitHub - panva/jose: JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Bro...
JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes. - panva/jose
@MrBBot Thanks! Good to know it's a known thing then. We can work around this one in particular without too much trouble. I also found an issue with
itty-router-extras
, which results in a different error "No such module". What's the issue in that particular case?Could you share the full stack trace/logs of the error youβre seeing?