nfour / serverless-build-plugin

A Node.js focused build plugin for serverless.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Function-level module excludes not working

ckfngod opened this issue · comments

functions:
  my-function:
    modules:
      exclude:
        - winston

This is not excluding winston from the my-function package. Am I missing something here?

commented

You may need to use excludeDeep as something else may be including it.

# functions
#
# Like the serverless.yml functions definition, but only for build options
functions:
  myFunction:
    # include
    #
    # An array of glob patterns to match against, including each file
    include:
      - functions/one/**
      - lib/one/**

    # exclude
    #
    # An array of glob patterns to exclude from the `include`
    exclude:
      - **/*.json

    modules:
      # modules.exclude
      #
      # Exclude specific node_modules for a function
      exclude:
        - lutils

      # modules.excludeDeep
      #
      # Exclude deeply nested node_modules for a function
      excludeDeep:
        - lutils

Also make sure this is defined inside of the build config object/file and not the serverless.yml:functions,