Registry / web-framework / universal-webpack

universal-webpack

JSON →
library0.8.5jsnpmunverified

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-webpack
INSTALL
IMPORT
SIG · UNIVERSAL-WEBPACK
U
universal-webpack
web-frameworkjavascriptv0.8.5
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

client
✓ import { client } from 'universal-webpack/config'
✗ const client = require('universal-webpack').client
ESM import from 'universal-webpack/config' (not root). CJS require from 'universal-webpack/config' works in Node.
server
✓ import { server } from 'universal-webpack/config'
✗ const server = require('universal-webpack').server
Same as client — subpath import, avoid root package require.
default
✓ import universalWebpack from 'universal-webpack'
✗ const u = require('universal-webpack').default
Root default export is a function? Check docs; typically use named imports from '/config'.

Shows how to set up client and server Webpack configs using universal-webpack with a base webpack.config.js.

// Install // npm install universal-webpack --save-dev // Create webpack.config.client.babel.js import { client } from 'universal-webpack/config' import settings from './universal-webpack-settings.json' import configuration from './webpack.config.js' export default client(configuration, settings) // Create webpack.config.server.babel.js import { server } from 'universal-webpack/config' import settings from './universal-webpack-settings.json' import configuration from './webpack.config.js' export default server(configuration, settings) // Create universal-webpack-settings.json { "server": { "input": "./source/server.js", "output": "./build/server/server.js" } } // Build // webpack --config webpack.config.client.babel.js // webpack --config webpack.config.server.babel.js
Debug
Known issues
gotchaThe base webpack configuration must not include 'entry' for the server; server entry is defined in settings.
fix
Ensure base webpack.config.js omits 'entry' or only sets client entry, and define server.input in universal-webpack-settings.json.
affects: >=0.1.0
gotchaIf you have multiple entry points, the library may behave unexpectedly.
fix
Use a single entry point for client; for server, define only one in settings.
affects: >=0.1.0
deprecatedThe old import path 'universal-webpack/client' is deprecated; use 'universal-webpack/config'.
fix
Update imports to 'universal-webpack/config'.
affects: <1.0.0
gotchaThe library expects a babel transpilation step for the config files ('.babel.js' extension).
fix
Rename config files to .babel.js or use webpack --config-register with babel-register.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'universal-webpack'
Package not installed or missing peer dependencies.
fix
Run `npm install universal-webpack --save-dev` and ensure webpack is installed.
TypeError: configuration is not a function or object
The base webpack.config.js is not exporting a plain object or function.
fix
Export a plain object or a function returning an object from webpack.config.js.
Error: 'server.input' is required in universal-webpack-settings.json
Missing server.input setting.
fix
Add `"server": { "input": "./path/to/server-entry.js", "output": "./path/to/output.js" }` to the settings file.
Upgrade
Version history
0.8.5latest on npm
Audit
Dependencies
webpackrequiredPeer dependency: used to create and extend Webpack configurations for client and server builds.
mini-css-extract-pluginoptionalPeer dependency: commonly used alongside universal-webpack for extracting CSS into separate files, though not strictly required.
Agent activity
5 hits · last 30 days
node
5
Resources
universal-webpack — npm install universal-webpack · libregistry