How TRPC Analyzes Bundle Size Changes In Real-Time
analyzeSizeChange analyzes bundle size changes in tRPC source code when building a package. It uses rollup-plugin-analyzer with options: summaryOnly, skipFormatted, and onAnalysis.
In the previous article, we provided a mental picture of functions in analyzeSizeChange.ts file, In this article, let’s find out how the actual size change is analyzed.
import analyze from 'rollup-plugin-analyzer';
export default function analyzeSizeChange(packageDir: string) {
let analyzePluginIterations = 0;
return analyze({
summaryOnly: process.env.CI ? undefined : true,
skipFormatted: process.env.CI ? true : undefined,
onAnalysis: (analysis) => {
},
});
}
analyze is imported from rollup-plugin-analyzer. It’s got an object as param with options:
su...