C
C#6mo ago
SiloCitizen3

Developing locally in VSCode for AWS SAM Lambdas with Layers and TS and module imports on Win 10

I'm using VSCode to author Typescript code, that gets transpiled using esbuild into javascript to push up to AWS (this seemingly works fine with the serverless.yaml template I have with the necessary metadata declarations). My issue is the use of layers and doing import {something} from 'some-lambda-layer' in some typescript file, and in order to get my "dry runs" locally (ie - sam build --beta-features ) to work, I had to, in my git bash configured terminal, do export NODE_PATH=~/path/to/where/the/layers/live/dependencies/nodejs so that within my typescript file, the imports worked and the build worked. Is there a better/easier way than manually setting the NODE_PATH env variable, to where the source code is on disk for layer dependencies, other than how I've done it?
0 Replies
No replies yetBe the first to reply to this messageJoin