Note: This package is unpublished. I was trolled by near identical named packages and now I have found an acceptable package so the world does not need this...
Allows project bundling via webpack for serverless invoke local and deploy
In your serverless project, run npm or yarn install. Note that to import the webpack config you also need the serverless-plugin-js-import
npm install --save-dev serverless-plugin-bundler serverless-plugin-js-import
You need to be running webpack in your project, so npm i --save-dev webpack
if you dont have it
Configure both plugins in the serverless.yml
like:
plugins:
- serverless-plugin-bundler
- serverless-plugin-js-import
Include a webpack configuration via import to an existing config file
custom:
webpack: ${file(./webpack.config.js)}
Include a webpack configuration, also in serverless.yml
like (example only)
custom:
webpack:
entry: ./handler.js
target: node
output:
libraryTarget: umd
filename: handler.js
path: dist/
module:
loaders:
-
test: /\.js$/
exclude: /(node_modules|dist)/
loader: babel-loader
The bundler has some minimal configuration here are the options which also go into the custom
section of the yaml under bundler
exactly as shown
custom:
bundler:
logging: true # Enables logging. SLS_DEBUG=* also enables this
clean: true # Allows for not cleaning the output dir. Defaults to true