Skip to content

Ship the Gutenberg JS bundle once instead of twice (−7.7 MB) - #25965

Draft
jkmassel wants to merge 1 commit into
trunkfrom
jkmassel/dedupe-gutenberg-jsbundle
Draft

Ship the Gutenberg JS bundle once instead of twice (−7.7 MB)#25965
jkmassel wants to merge 1 commit into
trunkfrom
jkmassel/dedupe-gutenberg-jsbundle

Conversation

@jkmassel

@jkmassel jkmassel commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Draft — opened to produce a CI build for on-device validation. Needs a manual editor smoke-test before it's ready for review (see Test Plan).

Summary

  • Ships the Gutenberg React Native JS bundle once instead of twice, removing a duplicate ~7.7 MB from the app.

Root Cause

The RN runtime loads the JS bundle via RCTBundleURLProvider / jsBundleURLForBundleRoot: — i.e. main.jsbundle from the app bundle root, placed there by the CopyGutenbergJS build phase. An identical copy (md5 fdfce7…, confirmed byte-for-byte) also ships inside the embedded Gutenberg.framework/App.js, but the framework binary references App.js zero times — it is never loaded at runtime. It existed only as the build-time copy source.

Fix

  • download-gutenberg-xcframeworks.sh: strip App.js from the Gutenberg.framework slices after they're copied into WordPress/Frameworks/, so it isn't embedded into (and code-signed with) the app.
  • CopyGutenbergJS.sh: source the app-root main.jsbundle from the byte-identical standalone react-native-bundle-source-map/main.jsbundle that already ships alongside the XCFramework.
  • CopyGutenbergJS.inputs.xcfilelist: repoint the phase input (also fixes a pre-existing dangling input path).

Measured on a clean unsigned Release archive: −7.7 MB uncompressed, no runtime change (same main.jsbundle, same path, same bytes).

Test Plan

  • On-device: open the classic (React Native) Gutenberg editor, load an existing post, insert/edit a block — confirm it loads and functions. This is the one that matters: the framework's App.js is gone, so a working editor proves the root main.jsbundle is what the runtime loads.
  • Editor works from a clean rake dependencies (CI bootstraps fresh, so green CI covers the pipeline change).
  • Both build scripts pass bash -n.
  • The bundle we now copy is byte-identical to the previous source (md5 fdfce7…).

Notes

Local devs must re-run rake dependencies to pick up the strip (cheap — no re-download). The RN editor is being replaced by GutenbergKit; this doesn't touch that migration, it just stops shipping the RN bundle twice in the meantime.

The React Native runtime loads main.jsbundle from the app bundle root, but a
byte-identical copy (~7.7MB) also ships inside Gutenberg.framework/App.js where
it is never loaded — the framework resolves the bundle via RCTBundleURLProvider
from the main bundle, not from itself (App.js is referenced zero times in the
framework binary).

Strip App.js from the framework at dependency-download time so it isn't embedded
and code-signed into the app, and source the app-root main.jsbundle from the
standalone react-native-bundle-source-map/main.jsbundle that already ships
alongside the XCFramework. Removes ~7.7MB from the app bundle, no runtime change.
@jkmassel jkmassel added Tooling Build, Release, and Validation Tools [Type] Tech Debt labels Sep 1, 2026
@jkmassel jkmassel self-assigned this Sep 1, 2026
@jkmassel jkmassel added this to the 27.3 milestone Sep 1, 2026
@dangermattic

Copy link
Copy Markdown
Collaborator
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number34117
VersionPR #25965
Bundle IDorg.wordpress.alpha
Commitd626c7e
Installation URL67umn87p41i58
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number34117
VersionPR #25965
Bundle IDcom.jetpack.alpha
Commitd626c7e
Installation URL0m79oh9s7gs9o
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

Copy link
Copy Markdown
Contributor

🤖 Build Failure Analysis

This build has failures. Claude has analyzed them - check the build annotations for details.

@jkmassel
jkmassel requested a review from dcalhoun September 1, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tooling Build, Release, and Validation Tools [Type] Tech Debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants