{"id":20543,"library":"serverless-plugin-webpack","title":"serverless-plugin-webpack","description":"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.","status":"abandoned","version":"1.5.1","language":"javascript","source_language":"en","source_url":"https://github.com/goldwasserexchange/serverless-plugin-webpack","tags":["javascript"],"install":[{"cmd":"npm install serverless-plugin-webpack","lang":"bash","label":"npm"},{"cmd":"yarn add serverless-plugin-webpack","lang":"bash","label":"yarn"},{"cmd":"pnpm add serverless-plugin-webpack","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required; only supports webpack 2.x or 3.x.","package":"webpack","optional":false}],"imports":[{"note":"This is a Serverless Framework plugin, not a standard npm module. It is configured in serverless.yml, not imported in code.","wrong":"// Using as an npm import in code (not applicable)\nconst plugin = require('serverless-plugin-webpack'); // This is a Serverless plugin, not a code library","symbol":"serverless-plugin-webpack","correct":"// Add to serverless.yml plugins array\nplugins:\n  - serverless-plugin-webpack"}],"quickstart":{"code":"// Install\nnpm install serverless-plugin-webpack webpack@3 --save-dev\n\n// serverless.yml\nservice: my-service\nplugins:\n  - serverless-plugin-webpack\nprovider:\n  name: aws\n  runtime: nodejs8.10\nfunctions:\n  hello:\n    handler: handler.hello\n\n// webpack.config.js\nmodule.exports = {\n  target: 'node',\n  externals: [/aws-sdk/],\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        exclude: /node_modules/,\n        loader: 'babel-loader',\n        query: {\n          presets: [\n            ['env', { target: { node: '8.10' }, useBuiltIns: true, modules: false, loose: true }],\n            'stage-0'\n          ]\n        }\n      }\n    ]\n  }\n};\n\n// Deploy\nsls deploy","lang":"javascript","description":"Shows minimal setup: install plugin and webpack 3, configure serverless.yml, create webpack.config.js, and deploy."},"warnings":[{"fix":"Do not specify entry or output in your webpack.config.js; the plugin will override them.","message":"Plugin uses serverless service handler references directly; custom webpack configs must not define entry/output as they are set by the plugin.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade to serverless-webpack (elastic-coders) which supports webpack 4+ and is actively maintained.","message":"Only supports webpack 2.x or 3.x. Webpack 4 and 5 are not supported.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Ensure ES6 modules are used and configure sideEffects in package.json to avoid dead code elimination failures.","message":"Individual function packaging may cause issues if functions share large dependencies; tree-shaking optimization can be unexpected if code has side effects.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade Serverless to v1.18.0 or later, or use an older version of the plugin.","message":"Dropped support for Serverless < 1.18.0 in v1.3.0.","severity":"breaking","affected_versions":">=1.3.0"},{"fix":"Review the generated .serverless directory to ensure correct files are included.","message":"Plugin automatically adds '**' as an exclude at service level; if you have custom excludes they will be merged, but unexpected exclusions may occur.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install webpack@3 --save-dev","cause":"Webpack is a peer dependency and must be installed separately.","error":"Error: Cannot find module 'webpack'"},{"fix":"npm install serverless-plugin-webpack --save-dev and ensure it's in serverless.yml plugins array.","cause":"The plugin is not installed or not listed as a plugin in serverless.yml correctly.","error":"Error: Cannot find module 'serverless-plugin-webpack'"},{"fix":"Upgrade Serverless to >=1.18.0.","cause":"Serverless version is below 1.18.0 (as of v1.3.0).","error":"Error: The serverless instance is not supported"},{"fix":"Update to v1.5.1 which fixes this bug.","cause":"Webpack stats output may be malformed when running in series (bug in v1.5.0).","error":"TypeError: Cannot read property 'length' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}