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) {
163
163
await Promise . all ( pending_ast_updates ) ;
164
164
165
165
// add imports
166
- let text = '' ;
167
166
if ( imports . size ) {
167
+ let text = '' ;
168
168
for ( const [ path , import_name ] of imports . entries ( ) ) {
169
169
text += `\timport ${ import_name } from "${ path } ";\n` ;
170
170
}
171
- }
172
171
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
+ }
178
178
}
179
179
180
180
if ( ast . css ) {
You can’t perform that action at this time.
0 commit comments