fix: include file names in CSS minification warnings#21634
Open
pierreeurope wants to merge 1 commit intovitejs:mainfrom
Open
fix: include file names in CSS minification warnings#21634pierreeurope wants to merge 1 commit intovitejs:mainfrom
pierreeurope wants to merge 1 commit intovitejs:mainfrom
Conversation
When CSS minification (via esbuild or lightningcss) produces warnings or errors, they now show the actual filename instead of generic names like '<stdin>' or 'style.css', making it much easier to debug which CSS file has the issue. This change: - Adds an optional 'filename' parameter to minifyCSS() function - Passes it to esbuild's 'sourcefile' option - Passes it to lightningcss's 'filename' option (replacing the TODO) - Updates finalizeCss() to accept and forward the filename parameter - Updates all call sites to pass the actual filename when available For single-file CSS (e.g., ?inline imports), the actual file path is used. For aggregated CSS chunks, the chunk name or CSS asset name is used to provide context. Fixes vitejs#15915 Signed-off-by: pierreeurope <pierre.europe@pm.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Description
Fixes #15915
When CSS minification (via esbuild or lightningcss) produces warnings or errors, they now display the actual filename instead of generic placeholders like
<stdin>orstyle.css. This makes it significantly easier to debug which CSS file has the issue.Changes
filenameparameter to theminifyCSS()functionsourcefileoption to provide context in warnings/errorsfilenameoption (addressing the existing TODO comment)finalizeCss()to accept and forward the filename parameter?inlineimports): uses the actual file pathBefore
After
Related
Checklist