Skip to content

Commit

Permalink
feat: Include bundle size visualization for production build (#16781)
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur- authored May 15, 2023
1 parent 508d8ff commit a23d76d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"vite": "4.3.5",
"@rollup/plugin-replace": "5.0.2",
"@rollup/pluginutils": "5.0.2",
"rollup-plugin-visualizer": "5.9.0",
"rollup-plugin-brotli": "3.1.0",
"vite-plugin-checker": "0.5.5",
"mkdirp": "1.0.4",
Expand Down
6 changes: 5 additions & 1 deletion flow-server/src/main/resources/vite.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import postcssLit from '#buildFolder#/plugins/rollup-plugin-postcss-lit-custom/r

import { createRequire } from 'module';

import { visualizer } from 'rollup-plugin-visualizer';

// Make `require` compatible with ES modules
const require = createRequire(import.meta.url);

Expand All @@ -49,6 +51,7 @@ const projectPackageJsonFile = path.resolve(__dirname, 'package.json');
const buildOutputFolder = devBundle ? devBundleFolder : frontendBundleFolder;
const statsFolder = path.resolve(__dirname, devBundle ? settings.devBundleStatsOutput : settings.statsOutput);
const statsFile = path.resolve(statsFolder, 'stats.json');
const bundleSizeFile = path.resolve(statsFolder, 'bundle-size.html');
const nodeModulesFolder = path.resolve(__dirname, 'node_modules');
const webComponentTags = '#webComponentTags#';

Expand Down Expand Up @@ -773,7 +776,8 @@ export const vaadinConfig: UserConfigFn = (env) => {
},
checker({
typescript: true
})
}),
!devMode && visualizer({ brotliSize: true, filename: bundleSizeFile })
]
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public void getDefaultDevDependencies_includesAllDependencies_whenUsingVite() {
expectedDependencies.add("rollup-plugin-brotli");
expectedDependencies.add("@rollup/plugin-replace");
expectedDependencies.add("@rollup/pluginutils");
expectedDependencies.add("rollup-plugin-visualizer");
expectedDependencies.add("vite-plugin-checker");
expectedDependencies.add("mkdirp");
expectedDependencies.add("workbox-build");
Expand Down

0 comments on commit a23d76d

Please sign in to comment.