Search code examples
typescriptamazon-web-servicesserverless

How to convert my serverless.ts file to serverless.yaml file and make the serverless project work?


I created a serverless project from a template aws-nodejs-typescript doing this:

sls create --template aws-nodejs-typescript --path my-app

However, it created for me a serverless.ts file instead of serverless.yaml. I converted the serverless.yaml file to ts file. However, I am stuck with some problems to make it work in my serverless configurations files. Error after running: sls deploy -v

Error after running: sls deploy -v

Do someone knows how to fix it? My project is in github:

Github Serverless Project

I would be very glad if someone can help me with this problem. Thank you very much in advance!


Solution

  • In your setup, serverless is looking for configuration in webpack.config.js.

    For serverless-webpack plugin you can specify location/name of a config file:

    custom:
      webpack:
        webpackConfig: 'webpack.config.ts'
    

    You could also try to migrate your webpack.config.ts to .js with tsc transpiler tsc --lib es6 webpack.config.ts