Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source Bundles Property for Manual Bundles, loadedBy #9294

Open
wants to merge 14 commits into
base: v2
Choose a base branch
from

Conversation

AGawrys
Copy link
Contributor

@AGawrys AGawrys commented Oct 4, 2023

↪️ Pull Request

This PR adds more configuration to the unstable_manualSharedBundle feature for the bundle. Users can now specify an array of "loadedBy" Bundles for a manualSharedBundle. The loadedBy property is essentiallybundle.sourceBundles within the bundler.

This allows assets that would otherwise match an MSB glob, to instead be duplicated or inserted into traditional shared bundles if needed. This is useful in the case that a later loading bundle requires an MSB. This way we can ensure the manual bundle is not loaded earlier by some other bundle requiring an asset it contains.

This pr also renames the optional "parent" config option to "root".

💻 Usage

Specify an array of BundleRoots (i.e. code split point or entries) via filePath relative to the project root, which will then use the manualSharedBundle, duplicating the assets for any other bundles which require those assets.

In the below example, only activeSource1.js and activeSource2.js (which are bundles) will use the vendor manualSharedBundle. Any other bundles that require vendor assets will get them from either a traditional shared bundle or via duplication.

{
            "@parcel/bundler-default": {
              "unstable_manualSharedBundles": [{
                "name": "vendor",
                "assets": ["vendor**"],
                "loadedBy": ["activeSource1.js", "activeSource2.js"]
              }]
            }
          }

✔️ 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

parcel-benchmark commented Oct 5, 2023

Benchmark Results

Kitchen Sink ✅

Timings

Description Time Difference
Cold 2.25s +260.00ms ⚠️
Cached 350.00ms -1.00ms

Cold Bundles

Bundle Size Difference Time Difference
dist/legacy/parcel.7cdb0fad.webp 102.94kb +0.00b 450.00ms +127.00ms ⚠️
dist/legacy/parcel.7cdb0fad.webp 102.94kb +0.00b 460.00ms +136.00ms ⚠️
dist/modern/parcel.7cdb0fad.webp 102.94kb +0.00b 459.00ms +136.00ms ⚠️
dist/legacy/index.ff03421b.js 1.48kb +0.00b 756.00ms +246.00ms ⚠️
dist/legacy/index.e9bb1616.js 1.06kb +0.00b 756.00ms +246.00ms ⚠️
dist/modern/index.4a29d309.js 921.00b +0.00b 755.00ms +246.00ms ⚠️
dist/legacy/index.html 826.00b +0.00b 663.00ms +111.00ms ⚠️
dist/modern/index.html 749.00b +0.00b 661.00ms +110.00ms ⚠️
dist/legacy/index.b8ae99ba.css 94.00b +0.00b 506.00ms +171.00ms ⚠️
dist/modern/index.31cedca9.css 94.00b +0.00b 505.00ms +169.00ms ⚠️

Cached Bundles

No bundle changes detected.

React HackerNews ✅

Timings

Description Time Difference
Cold 4.97s -82.00ms
Cached 501.00ms -244.00ms 🚀

Cold Bundles

Bundle Size Difference Time Difference
dist/logo.8dd07848.png 244.00b +0.00b 322.00ms +30.00ms ⚠️

Cached Bundles

Bundle Size Difference Time Difference
dist/index.js 459.11kb +0.00b 1.22s +72.00ms ⚠️
dist/PermalinkedComment.e9dc4a75.js 3.92kb +0.00b 480.00ms +64.00ms ⚠️
dist/UserProfile.8945a243.js 1.38kb +0.00b 480.00ms +64.00ms ⚠️
dist/NotFound.8b44a81d.js 269.00b +0.00b 480.00ms +64.00ms ⚠️

AtlasKit Editor ✅

Timings

Description Time Difference
Cold 46.04s +977.00ms
Cached 2.69s -114.00ms

Cold Bundles

Bundle Size Difference Time Difference
dist/pdfRenderer.01deafa1.js 12.04kb +0.00b 10.30s -4.61s 🚀
dist/heading4.be08fc9e.js 1.12kb +0.00b 6.86s -896.00ms 🚀
dist/pt_PT.e211e609.js 635.00b +0.00b 7.63s -2.88s 🚀

Cached Bundles

Bundle Size Difference Time Difference
dist/media-viewer.38e3999a.js 536.13kb +0.00b 10.51s -4.07s 🚀
dist/ConfigPanelFieldsLoader.182d39bc.js 303.43kb +0.00b 10.51s -3.10s 🚀
dist/card.d06de810.js 138.91kb +0.00b 10.51s -3.11s 🚀
dist/ElementBrowser.e8f01080.js 61.94kb +0.00b 10.51s -1.62s 🚀
dist/esm.bfca2115.js 59.30kb +0.00b 10.51s -3.11s 🚀
dist/component-lazy.51d1dec9.js 58.94kb +0.00b 6.85s -574.00ms 🚀
dist/ConfigPanelFieldsLoader.2b7c03be.js 15.74kb +0.00b 10.51s +546.00ms ⚠️
dist/ui.8c117104.js 14.48kb +0.00b 10.51s +547.00ms ⚠️
dist/ConfigPanelFieldsLoader.5dfde67d.js 13.63kb +0.00b 10.51s +547.00ms ⚠️
dist/pdfRenderer.01deafa1.js 12.04kb +0.00b 10.51s -3.68s 🚀
dist/mobile-upload.3baad8e4.js 7.79kb +0.00b 10.51s -3.10s 🚀
dist/mobile-upload.7a892a37.js 7.79kb +0.00b 10.51s -3.10s 🚀
dist/ru.0cf3f40e.js 2.81kb +0.00b 10.51s +547.00ms ⚠️
dist/uk.282f23b1.js 2.76kb +0.00b 10.51s +548.00ms ⚠️
dist/codeViewerRenderer.51140ec8.js 2.61kb +0.00b 10.51s -4.07s 🚀
dist/th.137e1013.js 2.60kb +0.00b 10.51s +547.00ms ⚠️
dist/pl.bce591be.js 2.25kb +0.00b 7.61s -539.00ms 🚀
dist/fr.ff5d335f.js 2.13kb +0.00b 7.61s -540.00ms 🚀
dist/hu.223c2cde.js 2.10kb +0.00b 7.61s -539.00ms 🚀
dist/ja.7d4156df.js 2.09kb +0.00b 7.61s -539.00ms 🚀
dist/vi.b46097db.js 2.09kb +0.00b 10.51s +548.00ms ⚠️
dist/pt_BR.b9e37d37.js 2.06kb +0.00b 7.61s -539.00ms 🚀
dist/tr.c85d90a9.js 2.03kb +0.00b 10.51s +548.00ms ⚠️
dist/ko.9c6bf469.js 1.98kb +0.00b 7.61s -539.00ms 🚀
dist/sv.1c06c95c.js 1.98kb +0.00b 10.51s +548.00ms ⚠️
dist/it.04edb54a.js 1.97kb +0.00b 7.61s -539.00ms 🚀
dist/nb.9bd6db78.js 1.96kb +0.00b 7.61s -539.00ms 🚀
dist/nl.c4d12122.js 1.94kb +0.00b 7.61s -539.00ms 🚀
dist/zh_TW.b7c55aa6.js 1.86kb +0.00b 10.51s +548.00ms ⚠️
dist/zh.b01fe721.js 1.84kb +0.00b 10.51s +546.00ms ⚠️
dist/workerHasher.540c9790.js 1.56kb +0.00b 10.51s -3.10s 🚀
dist/workerHasher.c840c607.js 1.56kb +0.00b 10.51s -3.10s 🚀
dist/heading4.be08fc9e.js 1.12kb +0.00b 6.85s -474.00ms 🚀
dist/sk.4be9c93f.js 656.00b +0.00b 10.51s +547.00ms ⚠️
dist/pt_PT.e211e609.js 635.00b +0.00b 7.61s -539.00ms 🚀
dist/simpleHasher.c14e20b4.js 589.00b +0.00b 10.51s -3.10s 🚀
dist/simpleHasher.23db7a52.js 589.00b +0.00b 10.51s -3.10s 🚀
dist/is.5f045a22.js 495.00b +0.00b 7.61s -541.00ms 🚀
dist/ro.8d5b380a.js 482.00b +0.00b 7.61s -2.35s 🚀

Three.js ✅

Timings

Description Time Difference
Cold 3.68s +98.00ms
Cached 411.00ms -4.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

Click here to view a detailed benchmark overview.

@AGawrys AGawrys requested a review from marcins October 5, 2023 00:19
@AGawrys AGawrys force-pushed the agawrys/active-manual-bundles-prop branch from 6af43da to dda9263 Compare December 13, 2023 00:40
@AGawrys AGawrys changed the title Active Source Bundles Property for Manual Bundles Source Bundles Property for Manual Bundles, loadedBy Dec 13, 2023
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.

None yet

2 participants