Skip to content

Commit

Permalink
fix(scss): improve error logs (#18522)
Browse files Browse the repository at this point in the history
Co-authored-by: Hiroshi Ogawa <hi.ogawa.zz@gmail.com>
  • Loading branch information
bluwy and hi-ogawa authored Oct 31, 2024
1 parent aec5fdd commit 3194a6a
Showing 1 changed file with 10 additions and 0 deletions.
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 @@ -2558,6 +2558,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 legacy api)
e.frame = e.message
}
return { code: '', error: e, deps: [] }
}
},
Expand Down

0 comments on commit 3194a6a

Please sign in to comment.