Skip to content

Commit 666dc61

Browse files
authored
fix: do not wrongly suggest that a lang attribute is missing when finding comments (#1166)
1 parent 6502681 commit 666dc61

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.changeset/fancy-guests-appear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/vite-plugin-svelte': patch
3+
---
4+
5+
skip comment blocks when reporting compiler errors that might be caused by a preprocessor issue

packages/vite-plugin-svelte/src/utils/error.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ export function enhanceCompileError(err, originalCode, preprocessors) {
132132

133133
let m;
134134
while ((m = styleRe.exec(originalCode))) {
135+
if (m[0]?.startsWith('<!--')) {
136+
continue;
137+
}
135138
// Warn missing lang attribute
136139
if (!m[1]?.includes('lang=')) {
137140
additionalMessages.push('Did you forget to add a lang attribute to your style tag?');

0 commit comments

Comments
 (0)