You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
Activate plugin in serverless.yml
plugins:
- serverless-plugin-transpiler
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:
Transpiler may be sync (return transpiled code directly) or async (may return promise)
If resolved value from transpiler is either null or undefined then it is assumed that no transpilation
was applied to this file, and original file content is passed as it is.
Example transpiler:
module.exports=function(content,filePath){if(!filePath.endsWith(".js"))returnnull;// transpile only JS filesreturntranspileES2019Feature(content);}
Configure path to preconfigured transpiler in serverless.yml
custom:
transpilerPath: lib/transpile.js
About
Serverless plugin: Transpile lambda files during packaging step