goldwasserexchange/serverless-plugin-webpack

Typescript support

sevenseat opened this issue · 2 comments

It would be great if this plugin would/could support typescript. Webpack can easily handle that with the ts-loader. However I've found two issues so-far with this typescript within serverless-plugin-webpack:

  • lib/service.js/fnPath hardcodes the .js extension
  • index.js/webpackDefaultOutput outputs a bundle with the same name as the handler.... In the case of a typescript handler, it would be something like handler.ts.... But running the function then fails, as lambda needs a .js file

I'm happy to attempt a patch.... However, I believe it will require some configuration within serverless.yaml. Would you be open to that?

FYI... I just implemented a simple workaround.... A javascript entry-point that delegates to a ts handler. It works perfectly. Here's the code:`

'use strict';
const delegate = require('./handler-delegated');
module.exports = delegate;

Thank you @JnJSW, will close this for now.