-
Notifications
You must be signed in to change notification settings - Fork 115
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
Support a way to process a URL with fragments #560
Comments
Hi @sapphi-red, Can you give more info on the use cases? Is there an alternative syntax that is maybe more suitable? This plugin follows the CSS specification and url fragments on imports do not have any effect there. So the current implementation is actually correct. |
Like this plugin supports, Vite supports importing from node_modules in the import of CSS files. /* can consume `node_modules`, `web_modules` or local modules */
@import "cssrecipes-defaults"; /* == @import "../node_modules/cssrecipes-defaults/index.css"; */
@import "normalize.css"; /* == @import "../node_modules/normalize.css/normalize.css"; */ We pass a custom resolve option to this plugin to also support Subpath imports (and other resolving features) in CSS. The advantage of supporting this in CSS is that it is intuitive by being consistent with Node.js and allows configuration in one place ( |
Those import statements do not have a url fragment. The current implementation completely skips imports with a fragment.
|
Ah, here's a complete example. "imports": {
"#*": "./*"
}, In this case, (Please let me know if there's still missing information.) |
This is purely non-standard magic right? And is it correct that this won't work?
@RyanZim Do you have a preference?
I would prefer |
Yes, it's not standardized. It's a feature of Node.js and Vite applied it to CSS.
Yes, that won't work. Both of those way would work for Vite. Another way I can think of is to default |
After some more thought I think we need to just revert to the old behavior. The intention behind #537 was to make this plugin more correct. Not to make it less useful. |
@sapphi-red Can you check if the test scenario I created covers the Vite use case? |
In Vite, we were resolving
@import '#foo'
with subpath imports. But since postcss 16.0.0 (#539), these URLs are filtered out before it reaches any code that the plugin user side can control. That made Vite not able to resolve these URLs (vitejs/vite#15861).Would it be possible to add an option to skip this default behavior?
The text was updated successfully, but these errors were encountered: