File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
packages/vite-plugin-svelte/src/utils Expand file tree Collapse file tree 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) => {
125125 const endStat = stats ?. start ( filename ) ;
126126 const compiled = compile ( finalCode , finalCompileOptions ) ;
127127
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+ }
135137 if ( endStat ) {
136138 endStat ( ) ;
137139 }
You can’t perform that action at this time.
0 commit comments