Skip to content

Commit

Permalink
docs: bundle analysis w/ emitFile for multiple bundles (#8505)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcattori authored Jan 12, 2024
1 parent 00c41a6 commit 04a8f66
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion docs/future/vite.md
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,35 @@ Remember that you can always check the [Vite performance docs][vite-perf] for mo

#### Bundle analysis

To visualize and analyze your bundle, you can use the [rollup-plugin-visualizer][rollup-plugin-visualizer] plugin.
To visualize and analyze your bundle, you can use the [rollup-plugin-visualizer][rollup-plugin-visualizer] plugin:

```ts filename=vite.config.ts
import { unstable_vitePlugin as remix } from "@remix-run/dev";
import { visualizer } from "rollup-plugin-visualizer";

export default defineConfig({
plugins: [
remix(),
// `emitFile` is necessary since Remix builds more than one bundle!
visualizer({ emitFile: true }),
],
});
```

Then when you run `remix vite:build`, it'll generate a `stats.html` file in each of your bundles:

```
build
├── client
│ ├── assets/
│ ├── favicon.ico
│ └── stats.html 👈
└── server
├── index.js
└── stats.html 👈
```

Open up `stats.html` in your browser to analyze your bundle.

## Troubleshooting

Expand Down

0 comments on commit 04a8f66

Please sign in to comment.