JORVEL

@jorvel/rspack-route-assets

An Rspack plugin that maps each entrypoint/route to the JS + CSS assets it needs, writing a manifest you can use for <link rel="preload"> hints and SSR head injection — so the right chunks load per route without over-fetching.

Plugin

rspack.config.mjs
js
import { jorvelRspackRouteAssetsPlugin } from '@jorvel/rspack-route-assets';

export default {
  plugins: [
    jorvelRspackRouteAssetsPlugin({
      outputFile: 'route-assets.json',   // manifest path in the output dir
      // ...JorvelRouteAssetsPluginOptions
    }),
  ],
};

Exports

ts
jorvelRspackRouteAssetsPlugin(options?: JorvelRouteAssetsPluginOptions): RspackPluginInstance;

// build a RouteAssetsMap from an entrypoints structure (unit-testable, no Rspack needed)
createRouteAssetsFromEntrypoints(entrypoints): RouteAssetsMap;

type RouteAssetsMap = Record<string, { js: string[]; css: string[] }>;

Consuming the manifest

Read the emitted route-assets.json in your SSR handler and inject preloads for the matched route via @jorvel/ssr's head injection (preload.ts helpers).