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

fix(scss): improve error logs #18522

Merged
merged 5 commits into from
Oct 31, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2556,6 +2556,16 @@ const scssProcessor = (
e.message = `[sass] ${e.message}`
e.id = e.file
e.frame = e.formatted
// modern api lacks `line` and `column` property. extract from `e.span`.
// NOTE: the values are 0-based so +1 is required.
if (e.span?.start) {
e.line = e.span.start.line + 1
e.column = e.span.start.column + 1
// it also lacks `e.formatted`, so we shim with the message here since
// sass error messages have the frame already in them and we don't want
// to re-generate a new frame (same as legavy api)
sapphi-red marked this conversation as resolved.
Show resolved Hide resolved
e.frame = e.message
}
return { code: '', error: e, deps: [] }
}
},
Expand Down