How to reduce bundle size?

Our netlify builds have started failing now that we’re including some more plasmic components in our nextjs build using getStaticProps. Some pages have ballooned to around 3.5MB. With many of the pages using plasmic components, when they are zipped up in Netlify, it is over the 50MB limit.

It seems as if most of the data is duplicated, and is actually just a list of css/js files with their contents as strings. Could plasmic expose these files to webpack using a custom loader so that they can be included in the build?

I’m not using plasmic cli btw

Removing antd from our component library reduced the bundle by about 1MB. That’s a fat one

Yeah, today the page-level payload includes everything needed to render that page, and nothing is shared between different pages.

For something like antd, you’ll have slimmer builds by depending on antd yourself, and registering them as code components. Webpack would then be able to bundle them once and share them across different pages. You can still install @plasmicpkgs/antd into your repo and use the same component registration calls we use, so you don’t have to register them by hand.