File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
packages/enhanced-img/src Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @sveltejs/enhanced-img ' : patch
3+ ---
4+
5+ fix: add script block only when there are imports to add
Original file line number Diff line number Diff line change @@ -163,18 +163,18 @@ export function image_plugin(imagetools_plugin) {
163163 await Promise . all ( pending_ast_updates ) ;
164164
165165 // add imports
166- let text = '' ;
167166 if ( imports . size ) {
167+ let text = '' ;
168168 for ( const [ path , import_name ] of imports . entries ( ) ) {
169169 text += `\timport ${ import_name } from "${ path } ";\n` ;
170170 }
171- }
172171
173- if ( ast . instance ) {
174- // @ts -ignore
175- s . appendLeft ( ast . instance . content . start , text ) ;
176- } else {
177- s . prepend ( `<script>${ text } </script>\n` ) ;
172+ if ( ast . instance ) {
173+ // @ts -ignore
174+ s . appendLeft ( ast . instance . content . start , text ) ;
175+ } else {
176+ s . prepend ( `<script>${ text } </script>\n` ) ;
177+ }
178178 }
179179
180180 if ( ast . css ) {
You can’t perform that action at this time.
0 commit comments