Skip to content

Reduce bundle size with nosource-source-map - #1649

Closed
petschki wants to merge 1 commit into
masterfrom
fix-nosources-source-map
Closed

petschki wants to merge 1 commit into
masterfrom
fix-nosources-source-map

Conversation

@petschki

@petschki petschki commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Bundle sizes compared by configuration:
bundle-analyzer-top10-sidebar-vergleich

Note:

bundle-analyzer doesn't recognize .map files at all but there's an important finding: css-loader and sass-loader add CSS maps into the JS chunks when devtools is configured. that's why the tinymce chunk gets smaller when changing the value here.

I've added sourceMap: false to the css/sass-loader maps options explicitly to get rid of that too when using nosource-source-map option. see variant 4 in the screenshot.

@petschki petschki changed the title Redurce bundle size with nosource-source-map Reduce bundle size with nosource-source-map Sep 17, 2026
@petschki
petschki force-pushed the fix-nosources-source-map branch from 9b28411 to 9c6cab8 Compare September 17, 2026 09:11
@petschki
petschki requested review from MrTango and thet September 17, 2026 09:11
The production build shipped full source maps with the embedded sources
of every chunk. With the lazy locale-data chunks this amounts to 159 MB
of maps for the Plone bundle, all of it committed to plone.staticresources
and installed on every deployment. nosources-source-map keeps the
mappings, so stack traces still point to the original file and line,
but drops the sources: 12 MB instead of 159 MB.

css-loader and sass-loader derive their sourceMap option from devtool,
and style-loader embeds the resulting CSS source maps into the JS
chunks, where every browser downloads and parses them: the TinyMCE
chunk alone grew from 1.9 MB to 3.2 MB (481 KB to 662 KB gzipped) with
full maps, and all non-locale chunks together carried 1.8 MB (330 KB
gzipped) of CSS maps. Switch them off explicitly for production builds.

Development builds keep the full source maps.
@thet
thet force-pushed the fix-nosources-source-map branch from 9c6cab8 to 301990e Compare September 17, 2026 11:41

@thet thet 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.

Great findings! Instead of adding this here, I want to move that into @patternslib/dev as new defaults.
I'm currently working on this.

@petschki

Copy link
Copy Markdown
Member Author

obsolete since @patternslib/dev==4.2.0 see #1652

@petschki petschki closed this Sep 17, 2026
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.

2 participants