Skip to content

Latest commit

 

History

History
70 lines (51 loc) · 2.02 KB

README.md

File metadata and controls

70 lines (51 loc) · 2.02 KB

Serverless Bundler Plugin

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

Build Status Coverage Status

Install

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

Setup

Configure both plugins in the serverless.yml like:

plugins:
  - serverless-plugin-bundler
  - serverless-plugin-js-import

Usage

Option 1

Include a webpack configuration via import to an existing config file

custom:
  webpack: ${file(./webpack.config.js)}

Option 2 - (Experimental)

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

Config

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