{"library":"serverless-plugin-transpiler","title":"serverless-plugin-transpiler","description":"A Serverless Framework plugin (v1.x compatible) that transpiles lambda function files during the packaging step. Version 2.0.0 allows you to define a custom transpiler function—either sync or async—that receives file contents and path, and returns transpiled code or null to skip. It is maintained by medikoo and designed to integrate any transpiler (e.g., Babel, TypeScript) into the Serverless packaging flow. The plugin relies on the serverless peer dependency (^1.21) and is configured via serverless.yml with a custom transpiler path. Compared to other transpilation plugins, it provides a flexible, low-level interface where the user controls the transpilation logic entirely.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install serverless-plugin-transpiler"],"cli":null},"imports":["plugins:\n  - serverless-plugin-transpiler","module.exports = function(content, filePath) {\n  // transpile logic\n  return transpiledContent;\n}","custom:\n  transpilerPath: lib/transpile.js"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// transpile.js - custom transpiler module\nmodule.exports = function(content, filePath) {\n  if (!filePath.endsWith('.js')) return null; // skip non-JS files\n  return content.replace(/process\\.env\\.MY_VAR/g, '\"static_value\"'); // example\n}\n\n// serverless.yml\nservice: my-service\nprovider:\n  name: aws\n  runtime: nodejs18.x\nplugins:\n  - serverless-plugin-transpiler\ncustom:\n  transpilerPath: path/to/transpile.js\nfunctions:\n  hello:\n    handler: handler.hello\n","lang":"javascript","description":"Shows minimal setup: a transpiler module that replaces environment variables, then the serverless.yml configuration to activate the plugin and reference the transpiler path.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}