Skip to content

Raise on unknown browsers in targets - #23

Merged
marcoroth merged 1 commit into
mainfrom
unknown-browsers
Oct 14, 2026
Merged

marcoroth merged 1 commit into
mainfrom
unknown-browsers

Conversation

@marcoroth

Copy link
Copy Markdown
Owner

This pull request updates targets to raise a LightningCSS::OptionError for a browser name it doesn't know, instead of ignoring it.

A misspelled browser, like safar: 15, used to be skipped without a word, so the stylesheet was compiled as if that target wasn't there. That's the same problem LightningCSS::Options already refuses an unknown option for.

LightningCSS.transform(".a {}", targets: { safar: 15 })
#=> LightningCSS::OptionError: Unknown browser in targets: safar

LightningCSS.transform(".a {}", targets: { netscape: 4, chrome: 100, mosaic: 1 })
#=> LightningCSS::OptionError: Unknown browsers in targets: mosaic, netscape

The names are checked before any version is read, and listed in order, so the message doesn't depend on hash order. ios still reads as ios_saf.

This raises for code that passed an extra key in targets, which used to do nothing.

@marcoroth
marcoroth merged commit d0fdefc into main Oct 14, 2026
11 checks passed
@marcoroth
marcoroth deleted the unknown-browsers branch October 14, 2026 08:26
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.

1 participant