Skip to content

Sort CSS module exports#8817

Merged
mattcompiles merged 1 commit into
v2from
mjones/css-module-export-order
Feb 6, 2023
Merged

Sort CSS module exports#8817
mattcompiles merged 1 commit into
v2from
mjones/css-module-export-order

Conversation

@mattcompiles

Copy link
Copy Markdown
Contributor

↪️ Pull Request

It's possible that CSS module exports are ordered differently between builds which then causes unnecessary cache invalidation. As the export order is not significant I've added a simple sort of the keys to ensure all builds are deterministic.

🚨 Test instructions

Existing tests should be sufficient.

✔️ PR Todo

  • Added/updated unit tests for this change
  • Filled out test instructions (In case there aren't any unit tests)
  • Included links to related issues/PRs

@parcel-benchmark

Copy link
Copy Markdown

Benchmark Results

Kitchen Sink ✅

Timings

Description Time Difference
Cold 2.00s -100.00ms 🚀
Cached 399.00ms -45.00ms 🚀

Cold Bundles

Bundle Size Difference Time Difference
dist/legacy/parcel.7cdb0fad.webp 102.94kb +0.00b 139.00ms -216.00ms 🚀
dist/legacy/parcel.7cdb0fad.webp 102.94kb +0.00b 140.00ms -216.00ms 🚀
dist/modern/parcel.7cdb0fad.webp 102.94kb +0.00b 141.00ms -214.00ms 🚀

Cached Bundles

Bundle Size Difference Time Difference
dist/modern/parcel.7cdb0fad.webp 102.94kb +0.00b 136.00ms -221.00ms 🚀

React HackerNews ✅

Timings

Description Time Difference
Cold 12.93s +6.00ms
Cached 579.00ms +56.00ms ⚠️

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

AtlasKit Editor ✅

Timings

Description Time Difference
Cold 2.20m -4.23s
Cached 2.88s -232.00ms 🚀

Cold Bundles

Bundle Size Difference Time Difference
dist/ConfigPanelFieldsLoader.71292279.js 312.70kb +0.00b 58.87s -3.08s 🚀
dist/DatePicker.93c6d7f2.js 48.71kb +0.00b 58.87s -3.08s 🚀
dist/DatePicker.cb6a97f0.js 25.50kb +0.00b 58.87s -3.08s 🚀
dist/ResourcedEmojiComponent.bef36b85.js 2.68kb +0.00b 58.87s -3.08s 🚀
dist/pl.4643976c.js 2.37kb +0.00b 58.87s -3.08s 🚀
dist/cs.08737142.js 2.28kb +0.00b 58.87s -3.08s 🚀
dist/de.c2e79abd.js 2.26kb +0.00b 58.87s -3.08s 🚀
dist/es.983af340.js 2.24kb +0.00b 58.87s -3.08s 🚀
dist/ja.b56014f3.js 2.24kb +0.00b 58.87s -3.08s 🚀
dist/fr.aaa4d0bf.js 2.20kb +0.00b 58.87s -3.08s 🚀
dist/pt_BR.6c08dcf7.js 2.17kb +0.00b 58.87s -3.08s 🚀
dist/hu.3d2e30a0.js 2.17kb +0.00b 58.87s -3.08s 🚀
dist/fi.080f52aa.js 2.13kb +0.00b 58.87s -3.08s 🚀
dist/ko.51863560.js 2.13kb +0.00b 58.87s -3.08s 🚀
dist/it.7bb93510.js 2.12kb +0.00b 58.87s -3.08s 🚀
dist/nb.67163f41.js 2.10kb +0.00b 58.87s -3.08s 🚀
dist/nl.336a2549.js 2.09kb +0.00b 58.87s -3.08s 🚀
dist/da.f39b0c8c.js 2.07kb +0.00b 58.87s -3.08s 🚀
dist/feedback.2ade51a8.js 1.92kb +0.00b 58.87s -3.08s 🚀
dist/heading6.e0c2f3cf.js 1.52kb +0.00b 58.87s -3.08s 🚀
dist/heading3.5b4663e8.js 1.51kb +0.00b 58.85s -3.09s 🚀
dist/heading5.df611011.js 1.39kb +0.00b 58.87s -3.08s 🚀
dist/expand.655beb16.js 1.33kb +0.00b 58.87s -3.08s 🚀
dist/heading4.3ae44c0a.js 1.28kb +0.00b 58.87s -3.08s 🚀
dist/pt_PT.1eda577d.js 786.00b +0.00b 58.87s -3.08s 🚀
dist/et.03b90e09.js 778.00b +0.00b 58.87s -3.08s 🚀
dist/is.0d0b2897.js 638.00b +0.00b 58.87s -3.08s 🚀
dist/en_GB.a4eaa606.js 623.00b +0.00b 58.87s -3.08s 🚀
dist/en.dced70ab.js 620.00b +0.00b 58.87s -3.08s 🚀

Cached Bundles

Bundle Size Difference Time Difference
dist/media-viewer-analytics-error-boundary.6847f80f.js 3.43kb +0.00b 1.75m +21.10s ⚠️
dist/heading3.5b4663e8.js 1.51kb +0.00b 1.02m +5.25s ⚠️
dist/ro.82d888a1.js 633.00b +0.00b 1.45m +26.93s ⚠️

Three.js ✅

Timings

Description Time Difference
Cold 9.81s +625.00ms ⚠️
Cached 376.00ms +22.00ms ⚠️

Cold Bundles

Bundle Size Difference Time Difference
dist/Three.js 580.02kb +0.00b 7.15s +606.00ms ⚠️

Cached Bundles

No bundle changes detected.

Click here to view a detailed benchmark overview.

@devongovett

Copy link
Copy Markdown
Member

Wonder if we should solve this upstream: parcel-bundler/lightningcss#291

@mattcompiles

Copy link
Copy Markdown
Contributor Author

@devongovett Not too fussed either way. However, while object key order is stable, I'd say relying on it isn't great and being explicit about order is a good thing.

@mischnic mischnic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can definitely do this for now and then remove it again once it's fixed (and released) upstream

@mattcompiles mattcompiles merged commit 9f673b0 into v2 Feb 6, 2023
@mattcompiles mattcompiles deleted the mjones/css-module-export-order branch February 6, 2023 23:58
marcins pushed a commit to marcins/parcel that referenced this pull request Jul 14, 2023
* upstream/v2:
  Sort global deps before injecting imports (parcel-bundler#8818)
  Sort CSS module exports (parcel-bundler#8817)
  fix: add extra information to unique bundles (parcel-bundler#8784)
  Don't blow up HMR when <link />s don't have hrefs (parcel-bundler#8800)
lettertwo added a commit that referenced this pull request Nov 6, 2023
* upstream/v2: (128 commits)
  [webextension] Add support for `chrome_style` (#8867)
  Switch to SWC minifier by default (#8860)
  Use BitSet for bundler intersections (#8862)
  best key logic truncating package names (#8865)
  Add support for loadConfig to resolver plugins (#8847)
  Missing edge for multiple targets (#8854)
  Split large runtime manifest into separate bundles (#8837)
  Improvements to new resolver (#8844)
  Fix published files for resolver
  New resolver implementation in Rust (#8807)
  Update yarn.lock (#8843)
  Bump napi-rs to latest (#8838)
  Support .proxyrc.cjs  (#8833)
  Sort global deps before injecting imports (#8818)
  Sort CSS module exports (#8817)
  fix: add extra information to unique bundles (#8784)
  Don't blow up HMR when <link />s don't have hrefs (#8800)
  v2.8.3
  Changelog for v2.8.3
  Address bug by updating an asset reference and merge conditions (#8762)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants