fix(css): lightningcss minify failed when build.target: 'es6' - #21933
Merged
sapphi-red merged 1 commit intoMar 19, 2026
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Repro
Running the following commands:
will produce the following output:
This only occurs when
config.build.targetises6. It will not occur withes2015.The reason js bundling works correctly is that oxc specifically supports the string
es6along withes2015:https://github.com/oxc-project/oxc/blob/c481b2fc7423cbeaff7cfbded4e569618e3e4bda/crates/oxc_syntax/src/es_target.rs#L31
fn from_str(s: &str) -> Result<Self, Self::Err> { match s.cow_to_ascii_lowercase().as_ref() { "es5" => Err(String::from("ES5 is not yet supported.")), + "es6" | "es2015" => Ok(Self::ES2015), "es2016" => Ok(Self::ES2016),Using
target: 'es6', cssMinify: 'lightningcss'in vite 7 also produces the same error. And sincecssMinify: 'lightningcss'is the default behavior in vite 8, to reduce migration regressions, I suggest supportinges6as an alias ofes2015for theconvertTargets()method of plugin css.This patch can also be safely backported to vite 7.