https://serverless-stack.com/ logo
#help
Title
# help
f

Filip Pyrek [AWS Hero]

02/17/2022, 1:25 PM
How is packaging/transpilation being done in SST? And how source maps are handled there? My case: I have lerna-based repository and I want to import some local lerna TypeScript package (
@package/logger
) to my function. - that works When error is thrown inside the local lerna package (
@package/logger
), the stack trace is broken and doesn’t show much. For example:
Copy code
{
  "errorType": "some-error",
  "errorMessage": "hello",
  "name": "some-error",
  "stack": [
    "some-error: hello",
    "    at l (/var/task/src/lambda.js:1:386)",
    "    at Runtime.p [as handler] (/var/task/src/lambda.js:1:467)",
    "    at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"
  ]
}
The stack trace should lead to
@package/logger
files.
a

Ashishkumar Pandey

02/17/2022, 1:28 PM
f

Filip Pyrek [AWS Hero]

02/17/2022, 1:30 PM
Thanks. I though that when SST generated
.js.map
files in the artifacts folder, that it’s enabled by default. I’m going to try that. 👍
t

thdxr

02/17/2022, 1:31 PM
You need to pass NODE_OPTIONS=--enable-source-maps
We should document this
a

Ashishkumar Pandey

02/17/2022, 1:32 PM
It’s documented in the link above @thdxr
t

thdxr

02/17/2022, 1:32 PM
Ah ok
f

Filip Pyrek [AWS Hero]

02/17/2022, 1:36 PM
Perfect, it works! Thanks @Ashishkumar Pandey. 😊 Btw. how does the packaging works? Is there a webpack? What if I want to use esbuild for better performance? Is it also somewhere in the docs? 🙂
a

Ashishkumar Pandey

02/17/2022, 1:37 PM
sst already uses esbuild.
f

Filip Pyrek [AWS Hero]

02/17/2022, 1:37 PM
Wow, that’s perfect! 🔝
a

Ashishkumar Pandey

02/17/2022, 1:38 PM
since you’re using a monorepo you should refer this as well - https://docs.serverless-stack.com/advanced/monorepo-project-structure