From c765bc197d4f70d96e410d22e6ee1d422ead7772 Mon Sep 17 00:00:00 2001 From: dmitrage Date: Fri, 4 Jun 2021 06:31:18 +0300 Subject: [PATCH] fix(linker): order of css imported from js (#1342) --- internal/bundler/linker.go | 4 ++-- internal/bundler/snapshots/snapshots_css.txt | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) 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 ----------