Registry / web-framework / webpack-lru-middleware

webpack-lru-middleware

JSON →
library0.1.0jsnpmunverified

A wrapper around webpack-dev-middleware that adds a lazy LRU cache for webpack entrypoints. When using webpack configurations with many entrypoints, it avoids building unused modules by only building entrypoints on demand. Supports preloading initial entries, mapping requests to entrypoint names, and lifecycle hooks. Current stable version is v0.1.0, released in 2017. It is in maintenance mode with no recent updates. It is intended for development use with Express/Connect-like servers.

npm install webpack-lru-middleware
INSTALL
IMPORT
SIG · WEBPACK-LRU-MIDDLE
W
webpack-lru-middleware
web-frameworkjavascriptv0.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

default export
const webpackLRU = require('webpack-lru-middleware');
The package is CommonJS only and does not ship TypeScript types.
default export
import webpackLRU from 'webpack-lru-middleware';
import { webpackLRU } from 'webpack-lru-middleware';
This is a default export; named import will not work.

Sets up webpack-lru-middleware with a webpack config, creating a lazy LRU cache for entrypoints.

const webpack = require('webpack'); const webpackDevMiddleware = require('webpack-dev-middleware'); const webpackLRU = require('webpack-lru-middleware'); const path = require('path'); const lru = webpackLRU({ defaultEntry: { __empty__: path.resolve(__dirname, './empty.js') }, initialEntry: [], mapToEntry: req => path.basename(req.path, '.js'), }); const webpackConfig = { entry: {}, // will be overridden by lru output: { filename: '[name].js', path: '/dist' } }; const compiler = webpack(lru.configure(webpackConfig)); const devMiddleware = webpackDevMiddleware(compiler); app.use(lru.createMiddleware(devMiddleware));
Debug
Known issues
breakingThe package is not compatible with webpack 5 without modifications.
fix
Use alternative webpack-dev-middleware caching or maintain a fork.
affects: >=0.1.0
deprecatedThe package has been unmaintained since 2017 and may not work with modern versions of webpack or Node.js.
fix
Consider using webpack's built-in persistent caching or a more recent middleware.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'webpack-lru-middleware'
The package is not installed or is installed as a dev dependency but used in runtime.
fix
Run 'npm install webpack-lru-middleware --save-dev' and ensure the import path is correct.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
webpack-dev-middlewarerequiredRequired to create the dev middleware instance that is wrapped.
webpackrequiredRequired to create the compiler.
Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
webpack-lru-middleware — npm install webpack-lru-middleware · libregistry