Revert "fix: hoist imports on top (#13082)" (#13131)

This reverts commit 81b32d8b5a.
pull/13132/head
Rich Harris 2 weeks ago committed by GitHub
parent e14c46fa9b
commit 2b362ddc63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,5 +0,0 @@
---
'svelte': patch
---
fix: hoist imports on top

@ -457,10 +457,7 @@ export function client_component(analysis, options) {
analysis.uses_slots || analysis.uses_slots ||
analysis.slot_names.size > 0; analysis.slot_names.size > 0;
// we hoist all the import declarations to the top of the file const body = [...module.body, ...state.hoisted];
const body = [...module.body, ...state.hoisted].sort((body_a, body_b) =>
body_a.type === 'ImportDeclaration' && body_b.type !== 'ImportDeclaration' ? -1 : 1
);
const component = b.function_declaration( const component = b.function_declaration(
b.id(analysis.name), b.id(analysis.name),

@ -1,5 +1,4 @@
import "svelte/internal/disclose-version"; import "svelte/internal/disclose-version";
import * as $ from "svelte/internal/client";
const __ENHANCED_IMG_1__ = "__VITE_ASSET__2AM7_y_a__"; const __ENHANCED_IMG_1__ = "__VITE_ASSET__2AM7_y_a__";
const __ENHANCED_IMG_2__ = "__VITE_ASSET__2AM7_y_b__"; const __ENHANCED_IMG_2__ = "__VITE_ASSET__2AM7_y_b__";
@ -7,6 +6,9 @@ const __ENHANCED_IMG_3__ = "__VITE_ASSET__2AM7_y_c__";
const __ENHANCED_IMG_4__ = "__VITE_ASSET__2AM7_y_d__"; const __ENHANCED_IMG_4__ = "__VITE_ASSET__2AM7_y_d__";
const __ENHANCED_IMG_5__ = "__VITE_ASSET__2AM7_y_e__"; const __ENHANCED_IMG_5__ = "__VITE_ASSET__2AM7_y_e__";
const __ENHANCED_IMG_6__ = "__VITE_ASSET__2AM7_y_f__"; const __ENHANCED_IMG_6__ = "__VITE_ASSET__2AM7_y_f__";
import * as $ from "svelte/internal/client";
var root = $.template(`<picture><source type="image/avif"> <source type="image/webp"> <source type="image/png"> <img alt="production test" width="1440" height="1440"></picture>`); var root = $.template(`<picture><source type="image/avif"> <source type="image/webp"> <source type="image/png"> <img alt="production test" width="1440" height="1440"></picture>`);
export default function Inline_module_vars($$anchor) { export default function Inline_module_vars($$anchor) {

Loading…
Cancel
Save