Specify tsconfig.json for serverless.ts

Using the typescript flavour for the Serverless template (serverless.ts), is there a way to:

  1. Specify the tsconfig file for the Serverless.ts file and,
  2. Use tsconfig-paths to utilise the paths property in the tsconfig file?

My use case is a serverless application within a nx workspace and trying to import the various libs to create the full template.

The serverless source code uses ts-node to transpile the serverless.ts, and customising the register function, can pass in tsconfig-paths, which would support the tsconfig paths option.

My issue is how to pass the tsconfig file into serverless to create the processed serverless definition. I can’t see a central place to parse (and pass around) parameters passed to the serverless module.
I’d like to achieve something like sls --config=serverless.ts --ts-config-path=tsconfig.app.json

1 Like