-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
resolveDir returned by load in virtual module is modified when passed to resolve callbacks #696
Comments
The resolve directory is intended for use with file system paths, and is being turned into a file system path. I believe it should be possible to implement this yourself without needing the resolve directory to behave differently. Is it possible for you to solve this yourself by storing the original URL to redirect URL mapping in a map inside your plugin and then checking that map later on when resolving further imports? |
yes,it can be done,I just think whether is there a better way to do this,for complex virtual module it would be better if there's some way to pass meta info other than dirinfo between load and resolve hook |
https://rollupjs.org/guide/en/#inter-plugin-communication something like that |
But in this case the load and resolve hook are part of the same plugin, and the path and namespace form a unique key for that information. So a map seems to me like the simplest and most direct solution in this case. |
yes,if it happens in same plugin,closure map shuld work,but if it happens in different plugin,it would be kind of trciky to do that |
I'm adding a new |
I write an real world esbuild unpkg plugin which simulates deno bundle, which reference https://esbuild.github.io/plugins/#http-plugin , It needs to deal with http redirect response.
even though I pass resolveDir(
https://unpkg.com/[email protected]/add.js
) in load results ,but I got resolveUrl(resolveDir: '/Users/admin/github/neo/packages/bundler/https:/unpkg.com/[email protected]/add.js'
) in resolve callback,which is unexpected。The text was updated successfully, but these errors were encountered: