Skip to content
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

Allow urls that contain fragments, fixes #560 #561

Merged
merged 1 commit into from
Mar 16, 2024

Conversation

romainmenke
Copy link
Collaborator

@romainmenke romainmenke commented Feb 20, 2024

The intention behind ignoring urls with a fragment was to make the plugin more correct.
The thinking at the time was that these are never valid imports for a filesystem.
With nodejs subpath imports that assumption is incorrect.

Copy link

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This test case covers the Vite use case 👍

@romainmenke
Copy link
Collaborator Author

@RyanZim could you take a look at this when you have time?
It is not very urgent given that Vite applies a patch for now, but I don't want to forget about this :) Thank you

@RyanZim
Copy link
Collaborator

RyanZim commented Mar 15, 2024

Apologies, I've been incredibly busy. This is technically a breaking change, right? Code LGTM.

@romainmenke
Copy link
Collaborator Author

romainmenke commented Mar 15, 2024

I don't think this is a breaking change :)

Import statements with fragments were ignored before this change.
Effectively resulting in left over @import in the middle of your CSS file.
This would be ignored by browsers as @import needs to come first.

This would be a silent failure.
But it is extremely unlikely that users started doing this since v14 was released.

After this change postcss-import will try to resolve the file.
Unless you have special handling, like Vite does, you will get a hard error on a missing file.

This is no longer a silent failure but users can trivially resolve this by removing the incorrect @import.

I changed it in v14 was because it is more correct in a bundler context when only considering the CSS specification. I wasn't aware of how tools like Vite used this.


Edit:

Always possible that I overlooked something :)

@RyanZim
Copy link
Collaborator

RyanZim commented Mar 16, 2024

Thanks for the detailed explanation. I think it's still technically a breaking change, key word being technically, but I agree it probably doesn't affect any real-world use, so probably safe to release without a major bump.

@RyanZim RyanZim merged commit eb9899b into master Mar 16, 2024
2 checks passed
@RyanZim RyanZim deleted the fix-560--resourceful-bornean-orang-utan-020229b133 branch March 16, 2024 00:32
@RyanZim
Copy link
Collaborator

RyanZim commented Mar 16, 2024

I'm a fairly strong believer in "never ship on Fridays," so will be sometime next week until this is released.

@RyanZim
Copy link
Collaborator

RyanZim commented Mar 20, 2024

Published v16.1.0

@romainmenke
Copy link
Collaborator Author

Thank you @RyanZim 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants