-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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 dynamically import uncached JSR module: "TypeError: Could not find constraint in the list of versions" #23965
Comments
There's code for it to cache bust and just work. It seems like it's not working with dynamic imports though. |
I’m facing the same thing. Let me confirm that it’s due to dynamic imports (I believe it is). |
Just a note that you can get around this by running with |
I've still been manually running If there was even a I also don't necessarily want them in deno.lock. |
I found out that if the dynamic imports are statically analysable, the issue does not occur. |
Version: Deno 1.43.4
I'm using a dynamic import to import a module based on an environment variable:
This allows users to have
DITTO_POLICY=jsr:@gleasonator/policy@0.2.0
, and it dynamically imports the module.When I do that, I get this error:
I am able to resolve that error by manually running
deno cache jsr:@gleasonator/policy@0.2.0
Then it works. Because the module is available now. The error disappears. But I would like it to be automatic.
To solve this, I wondered if some sort of
Deno.cache
runtime API exists (it doesn't?). The other option is to run a Deno subcommand that calls thedeno cache
API.It made me wonder, how does Deno resolve dynamic imports? Shouldn't we expect it to download and cache the module automatically like other imports? So it got me thinking that maybe this is a bug in Deno.
The text was updated successfully, but these errors were encountered: