Serverless Plugin Transpiler

homepage icon https://github.com/medikoo/serverless-plugin-transpiler
Follow @medikoo

Tracked

NPM Downloads Last Month
66
Issues
0
Stars
3
Forks
0
Watchers
3
Watch Star Fork Issue Download License NPM Build Status Coverage Status Contributors

Repo README Contents:

serverless-plugin-transpiler

Transpile lambda files during packaging step

Plugin for Serverless v1+

Register a transpiler function which will serve as a file content transformer before they land in lambda package.

Installation

$ npm install serverless-plugin-transpiler

Configuration (within serverless.yml)

  1. Activate plugin in serverless.yml
plugins:
  - serverless-plugin-transpiler
  1. Configure transpiler module, it should reside somewhere within your service.

Transpiler should be a function that on content (file contents) and filePath (full path to module) returns transpiled (if needed) content. Handling is as follows:

Example transpiler:

module.exports = function (content, filePath) {
	if (!filePath.endsWith(".js")) return null; // transpile only JS files

	return transpileES2019Feature(content);
}
  1. Configure path to preconfigured transpiler in serverless.yml
custom:
  transpilerPath: lib/transpile.js