{"id":26432,"library":"ssr-webpack","title":"ssr-webpack","description":"A framework-agnostic SSR webpack configuration for serverless deployment, supporting React (17/18/19) and Vue (2/3) with Vite, Webpack, or Rspack. Version 7.x (current 7.0.14) reduces dependency size by 2/3 and improves build speed 5-10x. Supports tight integration with Nest.js and Midway.js, and one-click deploy to Alibaba/Tencent Cloud Serverless. Actively maintained with weekly releases.","status":"active","version":"7.0.14","language":"javascript","source_language":"en","source_url":"https://github.com/zhangyuang/ssr","tags":["javascript","webpack","serverless","ssr","react","vue","typescript"],"install":[{"cmd":"npm install ssr-webpack","lang":"bash","label":"npm"},{"cmd":"yarn add ssr-webpack","lang":"bash","label":"yarn"},{"cmd":"pnpm add ssr-webpack","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core bundler used for SSR builds","package":"webpack","optional":false}],"imports":[{"note":"Default export is the webpack config generator function. ESM-only since v7.","wrong":"require('ssr-webpack')","symbol":"ssr-webpack","correct":"import srrWebpack from 'ssr-webpack'"},{"note":"TypeScript type for client webpack config, available since v7.","symbol":"type ClientConfig","correct":"import type { ClientConfig } from 'ssr-webpack'"},{"note":"TypeScript type for server webpack config.","symbol":"type ServerConfig","correct":"import type { ServerConfig } from 'ssr-webpack'"}],"quickstart":{"code":"import srrWebpack from 'ssr-webpack';\nimport { ReactSSR } from 'ssr-plugin-react';\n\nconst config = await srrWebpack({\n  type: 'client',\n  chainWebpack: (chain) => {\n    chain.plugin('define').tap(args => [{\n      ...args[0],\n      'process.env.API_BASE': JSON.stringify(process.env.API_BASE ?? 'http://localhost:3000/api')\n    }]);\n  },\n  plugins: [\n    new ReactSSR()\n  ]\n});\n\n// Export for webpack (e.g., webpack-merge)\nexport default config;","lang":"typescript","description":"Generates a client-side SSR webpack config with React plugin and environment variable injection."},"warnings":[{"fix":"Install Node.js 20 or later.","message":"v7 drops support for Node < 20. Upgrade Node to >= 20.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Call srrWebpack() and await the result, not require('ssr-webpack') directly.","message":"Default export changed from a webpack config object to an async function generating config.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Update to @ssr/plugin-* packages and use new API.","message":"Plugin system changed in v7. Old plugin imports from 'ssr-plugin-*' v6 may not work.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Migrate overrides to chainWebpack callback.","message":"The inlineConfig option is deprecated. Use chainWebpack instead.","severity":"deprecated","affected_versions":">=7.0.0"},{"fix":"Add 'ssr-plugin-vue' to dependencies and import VueSSR plugin.","message":"When using with Vue, must also install ssr-plugin-vue and configure accordingly.","severity":"gotcha","affected_versions":">=7.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install package: npm install ssr-webpack@latest","cause":"Package not installed or wrong import path.","error":"Error: Cannot find module 'ssr-webpack'"},{"fix":"Use import srrWebpack from 'ssr-webpack' (ESM) or require('ssr-webpack').default","cause":"Using CJS require() instead of ESM import, or importing wrong export.","error":"TypeError: srrWebpack is not a function"},{"fix":"Upgrade Node to >= 20 and retry.","cause":"Node version < 20.","error":"Error: The engine \"node\" is incompatible with this module."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}