A Serverless Framework plugin that bundles Lambda function code using Webpack, enabling tree-shaking, individual packaging, Babel transpilation, and custom loaders. Current stable version is 5.15.4, released April 2025. Requires Node.js >= 20 and supports Serverless v1 through v4 (with esbuild disabled in v4). Active development with monthly releases. Compared to serverless-bundle or serverless-esbuild, this plugin offers broader Webpack version support (3, 4, 5), NPM/Yarn packaging, async webpack config, and seamless integration with serverless-offline.
npm install serverless-webpackVerified import paths — ran on the pinned version, not inferred.
Initialize a Serverless service with serverless-webpack, install plugin, configure webpack for Node.js target, and create a basic handler.
Upgrade Node.js to version 20 or later.
Add build: esbuild: false to serverless.yml.
Ensure your code does not depend on is-builtin-module being available.
Migrate to Serverless v4 if needed.
Use copyPackageSectionNames in custom.webpack and ensure package.json has required fields.
Upgrade to v5.14.0+ or use Node <= 20.12.2 on Windows.
Use mode: 'development' or set devtool appropriately for local runs.
Run npm install serverless-webpack --save-dev.
Run npm install webpack --save-dev.
Ensure you are using the correct slsw object from the plugin; check serverless version compatibility.
Upgrade serverless-webpack to v5.14.0+.