TypeScript API / @laikacms/vite-plugin / pruneChunks
Function: pruneChunks()
ts
function pruneChunks(root, keep): Promise<string[]>;Remove every chunk that is not in keep — the paths load wrote during this build — so a renamed or deleted key cannot leave a stale .mdx behind.
Deliberately a sweep at the end of a build rather than a wipe at the start: the directory is inside the Vite root, and clearing it out from under a dev server running on the same project breaks its already-loaded chunk modules.
Parameters
| Parameter | Type |
|---|---|
root | string |
keep | ReadonlySet<string> |
Returns
Promise<string[]>
the paths removed.