A library that generates client-side and server-side Webpack configurations for isomorphic JavaScript applications, enabling seamless universal rendering. Version 0.8.5 is the latest stable release, with irregular updates. It requires Webpack >=5 and mini-css-extract-plugin as peer dependencies. Compared to Next.js, it gives experienced Webpack users full control over configuration, making it suitable for custom setups. It ships TypeScript type definitions and supports ESM and CJS via babel. The library provides `client()` and `server()` config creators that wrap a base webpack configuration, and requires a `universal-webpack-settings.json` file to define server entry and output paths.
npm install universal-webpackVerified import paths — ran on the pinned version, not inferred.
Shows how to set up client and server Webpack configs using universal-webpack with a base webpack.config.js.
Ensure base webpack.config.js omits 'entry' or only sets client entry, and define server.input in universal-webpack-settings.json.
Use a single entry point for client; for server, define only one in settings.
Update imports to 'universal-webpack/config'.
Rename config files to .babel.js or use webpack --config-register with babel-register.
Run `npm install universal-webpack --save-dev` and ensure webpack is installed.
Export a plain object or a function returning an object from webpack.config.js.
Add `"server": { "input": "./path/to/server-entry.js", "output": "./path/to/output.js" }` to the settings file.