Skip to content

Commit 38b4053

Browse files
authored
Revert "fix: hoist imports on top (#13082)"
This reverts commit 81b32d8.
1 parent 2d37826 commit 38b4053

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

.changeset/hip-beers-shake.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/svelte/src/compiler/phases/3-transform/client/transform-client.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,10 +457,7 @@ export function client_component(analysis, options) {
457457
analysis.uses_slots ||
458458
analysis.slot_names.size > 0;
459459

460-
// we hoist all the import declarations to the top of the file
461-
const body = [...module.body, ...state.hoisted].sort((body_a, body_b) =>
462-
body_a.type === 'ImportDeclaration' && body_b.type !== 'ImportDeclaration' ? -1 : 1
463-
);
460+
const body = [...module.body, ...state.hoisted];
464461

465462
const component = b.function_declaration(
466463
b.id(analysis.name),

packages/svelte/tests/snapshot/samples/inline-module-vars/_expected/client/index.svelte.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import "svelte/internal/disclose-version";
2-
import * as $ from "svelte/internal/client";
32

43
const __ENHANCED_IMG_1__ = "__VITE_ASSET__2AM7_y_a__";
54
const __ENHANCED_IMG_2__ = "__VITE_ASSET__2AM7_y_b__";
65
const __ENHANCED_IMG_3__ = "__VITE_ASSET__2AM7_y_c__";
76
const __ENHANCED_IMG_4__ = "__VITE_ASSET__2AM7_y_d__";
87
const __ENHANCED_IMG_5__ = "__VITE_ASSET__2AM7_y_e__";
98
const __ENHANCED_IMG_6__ = "__VITE_ASSET__2AM7_y_f__";
9+
10+
import * as $ from "svelte/internal/client";
11+
1012
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>`);
1113

1214
export default function Inline_module_vars($$anchor) {

0 commit comments

Comments
 (0)