How is packaging/transpilation being done in SST? ...
# help
f
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
f
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
You need to pass NODE_OPTIONS=--enable-source-maps
We should document this
a
It’s documented in the link above @thdxr
t
Ah ok
f
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
sst already uses esbuild.
f
Wow, that’s perfect! 🔝
a
since you’re using a monorepo you should refer this as well - https://docs.serverless-stack.com/advanced/monorepo-project-structure