Skip to content

Commit

Permalink
fix(css): show correct error when unknown placeholder is used for CSS…
Browse files Browse the repository at this point in the history
… modules pattern in lightningcss (#19070)
  • Loading branch information
sapphi-red authored Dec 25, 2024
1 parent afff05c commit 9290d85
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3221,10 +3221,12 @@ async function compileLightningCSS(
})
} catch (e) {
e.message = `[lightningcss] ${e.message}`
e.loc = {
file: e.fileName.replace(NULL_BYTE_PLACEHOLDER, '\0'),
line: e.loc.line,
column: e.loc.column - 1, // 1-based
if (e.loc) {
e.loc = {
file: e.fileName.replace(NULL_BYTE_PLACEHOLDER, '\0'),
line: e.loc.line,
column: e.loc.column - 1, // 1-based
}
}
throw e
}
Expand Down

0 comments on commit 9290d85

Please sign in to comment.