-
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
Relative import from redirected url #1742
Comments
Oh, that is different than I thought. Deno only deals in fully qualified module names... I suspect if you did |
Oops - I also wasn't aware browsers did this. Is In any case - this is a bug - we have to change Deno's behavior. |
Wohoo, this also will make "registry hacking" a lot easier, i.e. |
I ran into an issue that seems to match up here when attempting to import the neverland library.
|
Any idea how Deno would cache a redirect on disk? |
I've been looking at this issue as well (and took two stabs at a PR). Symlinks seem like a natural choice but it is not clear how a cross-origin redirect would be represented as a symlink. A second problem exists with the TypeScript language server which doesn't play well with symlinks. I think the problem with the current cache is that it's loosing information about the original http responses. One way to fix this would be to always store the complete http header in a separate file along with the response (if any) much like the mime type is stored now. Deno would then have to read this header file first and then either redirect or read the body file.
import "https://example.net/mod.ts";
// would resolve to https://example.com/bar/mod.ts The problem with the TypeScript language server could be fixed with a plugin. But this makes the developer experience significantly worse as everyone should install the plugin (enter: npm/yarn and a node_modules dir). Maybe deno could come with it's own preconfigured language server? Or at least a language server plugin which can resolve files in the DENO_DIR. |
There is currently a difference in behavior when importing a relative path from a remote module behind a redirect.
Deno resolves based on initial remote module URL.
Browser resolves based on final remote module URL.
Example:
https://unpkg.com/example
redirects tohttps://unpkg.com/[email protected]/cli.ts
and imports./example.ts
Deno says
Cannot resolve module "./example.ts" from ".../deps/https/unpkg.com/example"
Browser fetches
https://unpkg.com/[email protected]/example.ts
The text was updated successfully, but these errors were encountered: