File tree 2 files changed +14
-7
lines changed
packages/vite-plugin-svelte/src/utils
2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @sveltejs/vite-plugin-svelte ' : patch
3
+ ---
4
+
5
+ fix: remove pure comments only for Svelte 3
Original file line number Diff line number Diff line change @@ -125,13 +125,15 @@ export const _createCompileSvelte = (makeHot) => {
125
125
const endStat = stats ?. start ( filename ) ;
126
126
const compiled = compile ( finalCode , finalCompileOptions ) ;
127
127
128
- // prevent dangling pure comments
129
- // see https://github.com/sveltejs/kit/issues/9492#issuecomment-1487704985
130
- // uses regex replace with whitespace to keep sourcemap/character count unmodified
131
- compiled . js . code = compiled . js . code . replace (
132
- / \/ \* [ @ # ] _ _ P U R E _ _ \* \/ ( \s * ) $ / gm,
133
- ' $1'
134
- ) ;
128
+ if ( isSvelte3 ) {
129
+ // prevent dangling pure comments
130
+ // see https://github.com/sveltejs/kit/issues/9492#issuecomment-1487704985
131
+ // uses regex replace with whitespace to keep sourcemap/character count unmodified
132
+ compiled . js . code = compiled . js . code . replace (
133
+ / \/ \* [ @ # ] _ _ P U R E _ _ \* \/ ( \s * ) $ / gm,
134
+ ' $1'
135
+ ) ;
136
+ }
135
137
if ( endStat ) {
136
138
endStat ( ) ;
137
139
}
You can’t perform that action at this time.
0 commit comments