Registry / devops / serverless-plugin-webpack

serverless-plugin-webpack

JSON →
library1.5.1jsnpmunverified

A Serverless Framework plugin that automatically bundles each Lambda function individually using Webpack. Version 1.5.1 is the latest stable release (last updated in 2018). It supports webpack 2.x and 3.x (peer dependency), and was designed to work with Serverless v1.18+. Key differentiators: zero configuration required, functions are packaged individually for minimal deployment size, uses an array of Webpack configs (one per function) for better tree-shaking, and supports sls package/deploy/deploy function commands. This plugin is distinct from the more popular serverless-webpack plugin (by elastic-coders) and is now essentially superseded by that and newer tools like serverless-bundle. No longer actively maintained; users should migrate to serverless-webpack or serverless-esbuild.

npm install serverless-plugin-webpack
INSTALL
IMPORT
SIG · SERVERLESS-PLUGIN-
S
serverless-plugin-webpack
devopsjavascriptv1.5.1
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.

serverless-plugin-webpack
// Add to serverless.yml plugins array plugins: - serverless-plugin-webpack
// Using as an npm import in code (not applicable) const plugin = require('serverless-plugin-webpack'); // This is a Serverless plugin, not a code library
This is a Serverless Framework plugin, not a standard npm module. It is configured in serverless.yml, not imported in code.

Shows minimal setup: install plugin and webpack 3, configure serverless.yml, create webpack.config.js, and deploy.

// Install npm install serverless-plugin-webpack webpack@3 --save-dev // serverless.yml service: my-service plugins: - serverless-plugin-webpack provider: name: aws runtime: nodejs8.10 functions: hello: handler: handler.hello // webpack.config.js module.exports = { target: 'node', externals: [/aws-sdk/], module: { rules: [ { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader', query: { presets: [ ['env', { target: { node: '8.10' }, useBuiltIns: true, modules: false, loose: true }], 'stage-0' ] } } ] } }; // Deploy sls deploy
Debug
Known issues
gotchaPlugin uses serverless service handler references directly; custom webpack configs must not define entry/output as they are set by the plugin.
fix
Do not specify entry or output in your webpack.config.js; the plugin will override them.
affects: >=1.0.0
deprecatedOnly supports webpack 2.x or 3.x. Webpack 4 and 5 are not supported.
fix
Upgrade to serverless-webpack (elastic-coders) which supports webpack 4+ and is actively maintained.
affects: >=1.0.0
gotchaIndividual function packaging may cause issues if functions share large dependencies; tree-shaking optimization can be unexpected if code has side effects.
fix
Ensure ES6 modules are used and configure sideEffects in package.json to avoid dead code elimination failures.
affects: >=1.0.0
breakingDropped support for Serverless < 1.18.0 in v1.3.0.
fix
Upgrade Serverless to v1.18.0 or later, or use an older version of the plugin.
affects: >=1.3.0
gotchaPlugin automatically adds '**' as an exclude at service level; if you have custom excludes they will be merged, but unexpected exclusions may occur.
fix
Review the generated .serverless directory to ensure correct files are included.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'webpack'
Webpack is a peer dependency and must be installed separately.
fix
npm install webpack@3 --save-dev
Error: Cannot find module 'serverless-plugin-webpack'
The plugin is not installed or not listed as a plugin in serverless.yml correctly.
fix
npm install serverless-plugin-webpack --save-dev and ensure it's in serverless.yml plugins array.
Error: The serverless instance is not supported
Serverless version is below 1.18.0 (as of v1.3.0).
fix
Upgrade Serverless to >=1.18.0.
TypeError: Cannot read property 'length' of undefined
Webpack stats output may be malformed when running in series (bug in v1.5.0).
fix
Update to v1.5.1 which fixes this bug.
Upgrade
Version history
1.5.1latest on npm
Audit
Dependencies
webpackrequiredPeer dependency required; only supports webpack 2.x or 3.x.
Agent activity
4 hits · last 30 days
node
4
Resources
serverless-plugin-webpack — npm install serverless-plugin-webpack · libregistry