JSPM

serverless-import-config-plugin

0.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 807
  • Score
    100M100P100Q103456F
  • License MIT

Adds possibility to import YAML files in serverless.yaml config file

Package Exports

  • serverless-import-config-plugin

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (serverless-import-config-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Serverless Import Config Plugin

The Serverless Framework doesn't give possibility to import and merge multiple serverless.yml config files. This plugin gives possibility to split main config file into smaller YAML files.

Installation

Install with npm:

npm install --save-dev serverless-import-config-plugin

And then add the plugin to your serverless.yml file:

plugins:
  - serverless-import-config-plugin

Usage

Specify config files to import in custom.import list:

custom:
  import:
    - ./path/to/serverless.yml # path to YAML file with serverless config
    - ./path/to/dir # directory where serverless.yml can be find
    - module-name # node module where serverless.yml can be find
    - '@myproject/users-api' # monorepo package with serverless.yml config file
    - module-name/custom-serverless.yml # path to custom config file of a node module

custom.import can be also a string, when only one file needs to be imported:

custom:
  import: '@myproject/users-api'

Relative paths

All function handler paths are automatically prefixed by the imported config directory.

functions:
  postOrder:
    handler: functions/postOrder.handler # relative to the imported config

For other fields you need to use ${dirname} variable manually. ${dirname} points to a directory of imported config file.

custom:
  webpack:
    webpackConfig: ${dirname}/webpack.config.js