{"id":18928,"library":"webpack-lru-middleware","title":"webpack-lru-middleware","description":"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.","status":"maintenance","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/wejendorp/webpack-lru-middleware","tags":["javascript"],"install":[{"cmd":"npm install webpack-lru-middleware","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-lru-middleware","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-lru-middleware","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required to create the dev middleware instance that is wrapped.","package":"webpack-dev-middleware","optional":false},{"reason":"Required to create the compiler.","package":"webpack","optional":false}],"imports":[{"note":"The package is CommonJS only and does not ship TypeScript types.","symbol":"default export","correct":"const webpackLRU = require('webpack-lru-middleware');"},{"note":"This is a default export; named import will not work.","wrong":"import { webpackLRU } from 'webpack-lru-middleware';","symbol":"default export","correct":"import webpackLRU from 'webpack-lru-middleware';"}],"quickstart":{"code":"const webpack = require('webpack');\nconst webpackDevMiddleware = require('webpack-dev-middleware');\nconst webpackLRU = require('webpack-lru-middleware');\nconst path = require('path');\n\nconst lru = webpackLRU({\n  defaultEntry: { __empty__: path.resolve(__dirname, './empty.js') },\n  initialEntry: [],\n  mapToEntry: req => path.basename(req.path, '.js'),\n});\n\nconst webpackConfig = {\n  entry: {}, // will be overridden by lru\n  output: { filename: '[name].js', path: '/dist' }\n};\n\nconst compiler = webpack(lru.configure(webpackConfig));\nconst devMiddleware = webpackDevMiddleware(compiler);\n\napp.use(lru.createMiddleware(devMiddleware));","lang":"javascript","description":"Sets up webpack-lru-middleware with a webpack config, creating a lazy LRU cache for entrypoints."},"warnings":[{"fix":"Use alternative webpack-dev-middleware caching or maintain a fork.","message":"The package is not compatible with webpack 5 without modifications.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Consider using webpack's built-in persistent caching or a more recent middleware.","message":"The package has been unmaintained since 2017 and may not work with modern versions of webpack or Node.js.","severity":"deprecated","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install webpack-lru-middleware --save-dev' and ensure the import path is correct.","cause":"The package is not installed or is installed as a dev dependency but used in runtime.","error":"Error: Cannot find module 'webpack-lru-middleware'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}