Repository navigation
Minor Changes
-
8d9aeed: Add
getEntrypointScriptUrls(webpackStats, entrypoint, compilation)for turning client stats into script URLs.
It supports single and multi-compilation stats, joinspublicPathwith or without a trailing slash, and throws for an unknown entrypoint or compilation. -
8d9aeed: Make the Express peer dependency optional for build-only users.
Express is loaded lazily bycreateDevRouter, and the package entry point no longer references Express types. -
8d9aeed: Export the public
Options, route and stats types from the package entry point.
Include route fields in theMapStatsToParams<Route>parameter type.
GetRouteFromRequestmay now returnundefined, andTransformExpressPathmay returnundefinedto exclude a route. -
f2ef91d: Evaluate renderer bundles with Node's
vm.compileFunctioninstead of theevalpackage.This changes some details of the rendering behaviour:
- Values crossing into a bundle now satisfy
instanceof. Bundles previously ran in a freshvmcontext, so arrays, errors and promises created outside it failed checks likevalue instanceof Array. __dirnameand__filenameare now defined, pointing at the evaluated asset and its directory in the compiler's output. Both wereundefinedbefore.- Dynamic
import()now works. It previously threwERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING, since avmcontext has no import callback.
Note: bundles are no longer isolated from the build process. Writes to globals, prototypes or undeclared variables used to die with each asset's
vmcontext; they now persist for the build and are visible to other assets and the plugin.extraGlobalsare module-scope bindings, soglobalThis.<name>no longer resolves. - Values crossing into a bundle now satisfy
Patch Changes
-
8d9aeed: Normalize dev-router paths with a leading slash, so routes written as
"about"or""work in development as well as in the static build.
The default""route is served at/.
Returningundefined, or an empty string for any other route, still excludes it from the dev router.Normalization affects file and Express paths only; the renderer still receives the route string as configured.
-
f2ef91d: Fix the development server error page to emit real client asset URLs with webpack 5 stats, collecting scripts from every entrypoint and skipping the renderer entry when a single compilation uses the renderer's own stats.
Also stop requests from hanging whengetRouteFromRequestreturns no route or a route outside the configured set. -
8d9aeed: Queue dev-router renders correctly when a request arrives before the build is ready.
Queued renders now go throughmapStatsToParamsinstead of calling the raw renderer. -
f2ef91d: Update runtime dependencies:
- Replaced
chalkwith Node's built-inutil.styleText - Upgrade
schema-utilsto v4
- Replaced
-
8d9aeed: Render single-compilation builds with the default
mapStatsToParams.
The renderer's own stats are used when there is no client compilation, instead of callingMultiStats.toJson()with an empty list. -
f2ef91d: Support webpack 5.112 by resolving
MultiStatsfrom both its current and previous module locations. -
f2ef91d: Declare
webpackas a peer dependency (^5.0.0)