serverless-plugin-ncc
A serverless plugin to use @zeit/ncc for bundling
Last updated a year ago by jaydp17 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install serverless-plugin-ncc 
SYNC missed versions from official npm registry.

serverless-plugin-ncc

A serverless plugin to use @zeit/ncc for compiling code before packaging.

Usage

npm install -D serverless-plugin-ncc @zeit/ncc

@zeit/ncc is a peer dependency, so we'll have to install it separately.

Add the pluging to serverless.yml

plugins:
  - serverless-plugin-ncc

How to use with TypeScript files?

# serverless.yml

functions:
  typescriptFn:
    # the plugin checks for src/index.ts as well as src/index.js
    # whichever exists is picked up
    handler: src/index.handler

Pass options

Custom options can be passed to ncc like this:

# serverless.yml

custom:
  ncc:
    minify: true

Note that all options are currently passed directly to ncc. To view all possible options check the ncc docs

Pass custom options per-function

Passing custom options to a function is as simple as introducing a custom block under the function with your ncc config

# serverless.yml

functions:
  hello:
    handler: src/hello/index.hello
    custom:
      ncc:
        minify: false

Disable ncc per function

You can pass enabled: false as custom config per function to disable ncc on that function

# serverless.yml

functions:
  hello:
    handler: src/hello/index.hello
    custom:
      ncc:
        enabled: false

License

MIT

Current Tags

  • 0.4.0                                ...           latest (a year ago)

8 Versions

  • 0.4.0                                ...           a year ago
  • 0.3.0                                ...           a year ago
  • 0.2.2                                ...           2 years ago
  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 3
Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |