Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Resolved conflicts by taking GitHub versions for: - .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml Kept deploy.sh updated to: - Pull from GitHub (primary source) - Push to Gitea (push-mirror) - Build from site/ directory (GitHub structure) Co-Authored-By: Paperclip <noreply@paperclip.ing>
37 lines
1.5 KiB
TypeScript
37 lines
1.5 KiB
TypeScript
import HotReloaderWebpack from './hot-reloader-webpack';
|
|
import type { RouteDefinition } from '../route-definitions/route-definition';
|
|
import type { MultiCompiler } from 'webpack';
|
|
/**
|
|
* Rspack Persistent Cache Strategy for Next.js Development
|
|
*
|
|
* Rspack's persistent caching differs from Webpack in how it manages module graphs.
|
|
* While Webpack incrementally updates modules, Rspack operates on complete module
|
|
* graph snapshots for cache restoration.
|
|
*
|
|
* Problem:
|
|
* - Next.js dev server starts with no page modules in the initial entry points
|
|
* - When Rspack restores from persistent cache, it finds no modules and purges
|
|
* the entire module graph
|
|
* - Later page requests find no cached module information, preventing cache reuse
|
|
*
|
|
* Solution:
|
|
* - Track successfully built page entries after each compilation
|
|
* - Restore these entries on dev server restart to maintain module graph continuity
|
|
* - This ensures previously compiled pages can leverage persistent cache for faster builds
|
|
*/
|
|
export default class HotReloaderRspack extends HotReloaderWebpack {
|
|
private builtEntriesCachePath?;
|
|
private isClientCacheEnabled;
|
|
private isServerCacheEnabled;
|
|
private isEdgeServerCacheEnabled;
|
|
afterCompile(multiCompiler: MultiCompiler): Promise<void>;
|
|
ensurePage({ page, clientOnly, appPaths, definition, isApp, url, }: {
|
|
page: string;
|
|
clientOnly: boolean;
|
|
appPaths?: ReadonlyArray<string> | null;
|
|
isApp?: boolean;
|
|
definition?: RouteDefinition;
|
|
url?: string;
|
|
}): Promise<void>;
|
|
}
|