Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Relative import from redirected url #1742
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.
I ran into an issue that seems to match up here when attempting to import the neverland library.
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.