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

width: -webkit-fill-available; is removed unexpectedly #826

Open
Lutymane opened this issue Oct 8, 2024 · 6 comments
Open

width: -webkit-fill-available; is removed unexpectedly #826

Lutymane opened this issue Oct 8, 2024 · 6 comments

Comments

@Lutymane
Copy link

Lutymane commented Oct 8, 2024

I'm using Lightning CSS for cssMinify option in Vite and I noticed it removes width: -webkit-fill-available; in production styles.

I also tried to do this in Vite config:

css: {
    lightningcss: {
      targets: browserslistToTargets(browserslist(">= 0.25%")),
    },
  },

but it still removes the rule.

What is wrong?

Lightning CSS version: 1.27
Vite: 5.4.8

@devongovett
Copy link
Member

Please provide a reproduction. Try the playground here: https://lightningcss.dev/playground/index.html

@fregante
Copy link

fregante commented Dec 8, 2024

I can confirm the issue. I was stumped because I could only reproduce via my rollup setup (and unplugin-lightningcss).

The most confusing part is that include: Features.Nesting | Features.VendorPrefixes still added a bunch of antiquate prefixes but not on fill-available, which was supposedly added in #186

@devongovett
Copy link
Member

I think this is working as expected? You should always provide browser targets to lightningcss. If you don't, we assume you are targeting a theoretical browser with perfect support for standards, so fallbacks and prefixes will be removed. We need to know what browser you actually want to target so we can output the correct code.

@Lutymane
Copy link
Author

Lutymane commented Dec 8, 2024

Hmm but isn't it counter intuitive? Since if you don't supply the target that means you don't know which browser will use the code, thus it definitely shouldn't remove anything at least. Just perhaps not adding anything extra? It just leads to hard to pinpoint problems like this one with Vite

@fregante
Copy link

fregante commented Dec 8, 2024

I think that inheriting Vite's targets is a "good default", however removing the prefixed value is a bug because no browser currently supports the non-prefixed value.

Another way to think of it: it's not a "prefixed value", but just "a valid value for all current browsers". As such, it should not be removed.

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

No branches or pull requests

6 participants
@devongovett @fregante @Lutymane and others