-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find module ... @tsndr/cloudflare-worker-jwt/utils #66
Comments
This started in 2.4.1 when // index.js
import { ... } from "./utils"; This is incompatible with Node's ESM algorithm, which requires explicit // src/index.ts
import { ... } from "./utils.js"
Hopefully these info are helpful. I will keep experimenting when i have some more time. For the record, I'm using |
I'm looking into this, sorry for the inconvenience. |
Hey guys, I've created a test project, but for me everything is working as expected: |
same, trying on localhost in nuxt: 3.4.3 project
|
@tsndr yeah, a bundler is smart enough to resolve it without problem. esbuild is used in the case of Now I understand this is a bit unexpected because the package is targeted at cloudflare environment and not node. But in the context of some frameworks (sveltekit for me and nuxt for @focus-at, which build apps to compatible output for cloudflare), seems like sometimes the modules are evaluated with node at build time. I am not sure if this is really necessary and should or should not be fixed from the framework side, but having the package compatible with Node's ESM algorithm would definitely be convenient. I created this repo that reproduces the issue, please see README for the steps. Here is the full log:
|
It is happening to us also when running tests in vitest. Running workers with wrangler 3.28.4 (latest at this moment). |
Hey guys, I've now added @vnphanquang I really appreciate your effort with the PR (#67), but I've just switched over from js to ts a little while ago and would like to keep it that way. I think a bundler is the best way forward for now, but I'm also always open for feedback and suggestions :) |
@tsndr thank you. No worries I understand 😀 |
Thank you very much!!! |
FYI, builds on Cloudflare Pages started failing in the last few days:
My package.json was:
@tsndr/cloudflare-worker-jwt": "^2.2.1
. I removed the^
and builds are working again. I also tried2.4.3
but saw the same error when running locally.In case it matters, I use the module format to import the library:
Deployment Log:
The text was updated successfully, but these errors were encountered: