diff --git a/internal/bundler/linker.go b/internal/bundler/linker.go index 78a0ccfd634..5440dffd2ac 100644 --- a/internal/bundler/linker.go +++ b/internal/bundler/linker.go @@ -2809,8 +2809,8 @@ func (c *linkerContext) findImportedFilesInCSSOrder(entryPoints []uint32) (exter } // Include all files reachable from any entry point - for _, entryPoint := range entryPoints { - visit(entryPoint, ast.Index32{}) + for i := len(entryPoints) - 1; i >= 0; i = i - 1 { + visit(entryPoints[i], ast.Index32{}) } // Reverse the order afterward when traversing in CSS order diff --git a/internal/bundler/snapshots/snapshots_css.txt b/internal/bundler/snapshots/snapshots_css.txt index 193238ef076..a2a01b1ea16 100644 --- a/internal/bundler/snapshots/snapshots_css.txt +++ b/internal/bundler/snapshots/snapshots_css.txt @@ -229,16 +229,16 @@ console.log("a"); console.log("b"); ---------- /out/entry.css ---------- -/* b.css */ -.b { - color: blue; -} - /* a.css */ .a { color: red; } +/* b.css */ +.b { + color: blue; +} + ================================================================================ TestPackageURLsInCSS ---------- /out/entry.css ----------