Lambda Layer in Typesacript won't be complied before deployment

I’m trying to use Lambda Layers with Node.js and Typescript template. I added the Lambda Layer in serverless.yaml:

    path: src/layers/base
    name: ${self:service}-${self:provider.stage}-base
      - nodejs

But the source code of the folder src/layers/base will not compiled from Typescript to Javascript. It will simply be uploaded as it is as Typescript code.

The folder contains only an index.ts file and two other .ts files, but no separate package.json.

Do I need to adapt my tsconfig or webpack config to compile TS to JS before uplaoding the layer?

We’ve been using typescript with lambdas for several years now. At first we used webpack, various versions of it with ts-loader and so, but we learned that minification is not good for debugging as stack traces would say like ”error reading x of undefined at handler.js row 1 character 233024”. Not very informative. There were also other problems with webpack.