@brandy
To get the total bundle size when building with Vite, you can use the size-limit
plugin.
Here's how you can do it:
1
|
npm install -D size-limit |
1 2 3 4 5 6 |
"size-limit": [ { "path": "dist/main.js", "limit": "200 KB" } ] |
Replace dist/main.js
with the path to your main JavaScript bundle file.
1 2 3 |
"scripts": { "size-limit": "size-limit" } |
1
|
npm run size-limit |
This will analyze the size of your bundle and let you know if it exceeds the specified limit.