chore: review BundleAnalyzer output and clean#3590
Merged
Conversation
tefkah
approved these changes
Apr 20, 2026
Member
tefkah
left a comment
There was a problem hiding this comment.
gah, how silly of me! great catch!
Member
|
i also have a branch that had a go at minifying the bundle at some point, mostly wrt lazy loading more of the languages in the editor, can see if i can still clean that up! |
Member
|
i think the eventual solution should ofc be that we have route based bundles tho. I'm not sure how we could get there without reworking our entire tooling, but it's silly that stuff only happening on the doi page is affecting every other page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reduces initial page load by ~958 KB through dead code removal and removing an accidental storybook data inclusion. No runtime logic changes — just a dead import removal and a build-time guard fix (which also fixes a bug in DOI validation links).
Changes
1. Remove storybook mock data from production bundle (-640 KB from main)
Doi.tsxhad a staleimport { pubData } from 'utils/storybook/data'that pulled 640 KB of mock fixtures (fake community, pub, discussion, overview data) into the productionmain.jschunk. The import was dead except for two<a href>links inrenderValidationWarnings()that were accidentally using the storybook mock'spubData.sluginstead ofthis.props.pubData.slug— a bug causing incorrect links on the DOI validation warnings UI. Fixed by removing the import and destructuringpubDatafromthis.props.2. Exclude prosemirror-dev-tools from production build (-166 KB from vendor, -152 KB jsondiffpatch)
useEditorView.tsguarded theimport('prosemirror-dev-tools')call withisDevelopment(), a runtime hostname check. Webpack cannot dead-code-eliminate runtime conditions, so the dynamic import chunk (and all of prosemirror-dev-tools + jsondiffpatch) was still bundled in production. Changed toprocess.env.NODE_ENV !== 'production', which the existingDefinePluginresolves tofalseat build time, allowing Terser to strip the entire block and its dependencies.Results (dev build, unminified)
Breakdown of savings by source
Files changed
client/containers/DashboardSettings/PubSettings/Doi.tsx— remove storybook import, fix pubData bugclient/components/Editor/hooks/useEditorView.ts—isDevelopment()→process.env.NODE_ENV !== 'production'Risk
Very low. Both changes only remove dead code paths: