-
-
Notifications
You must be signed in to change notification settings - Fork 591
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
[node-resolve] Support hashes or query params in path #486
Comments
Agree this is valuable. Please do PR this! |
I started working on this where node resolve would resolve the path without the query params and hashes, and then puts them back on at the end. However this breaks further bundling because rollup will try to find a file on the file system with the query param or hash. (for example For my use case it's OK, because I'm using the plugin for single file transforms for the browser. But it I'm not sure how this should be implemented properly in the plugin. @lukastaegert do you have any insights here? What happens when you use rollup in the browser? Are imports resolved to browser imports? |
I like to understand this first. As you are bundling anyway, I would assume the query parameters are meant to influence the bundling process and be consumed by another plugin, is that correct? In extension, if they are to influence the bundling process, then using different parameters needs to resolve to different modules, is that correct as well? Then I would say vanilla Rollup supports this well enough. However, you would need to make sure you define a loader that tells Rollup how such a module is meant to be loaded as I would assume, Node does not resolve query parameters very well. |
This in the context of tools like es-dev-server, where I'm reusing the rollup node resolve plugin. I want to resolve bare imports, but preserve the query params and hashes as they were in the original source code. I'm looking for how this can be implemented in a way that still makes sense for regular use of the plugin. You're right that in the context of bundling with rollup a query parameter can be an instruction to another plugin which could implement a load hook. The commonjs plugin does this already. I whipped something up in #487 |
I have encounter this issue with rollup plugin babel. It doesn't recognize I have created an issue for plugin-babel: #500 |
Feature Use Case
In the browser it's common to use hashes or query params to pass along some state. Node resolve fails to solve imports with query params or hashes.
Feature Proposal
Resolve imports with query param or hashes. For example an import such as:
Should be resolved to:
I can work on a PR for this we think this feature is valueable.
The text was updated successfully, but these errors were encountered: