Can we get sourcemaps in output for Typescript exc...
# sst
a
Can we get sourcemaps in output for Typescript exceptions while building stacks? I've been doing a lot of piecemeal commenting out and in code to find the source of my failures.
t
We don't run typechecking on builds, just esbuild
a
Example:
Copy code
% npx sst build account-api
Using stage: adam
Preparing your SST app
Synthesizing CDK

Error: Cannot find module './impl/format'
Require stack:
- /Users/adamfanello/dev/onica/casa/cloud/.build/lib/index.js
- /Users/adamfanello/dev/onica/casa/cloud/.build/run.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at /Users/adamfanello/dev/onica/casa/node_modules/jsonc-parser/lib/umd/main.js:16:21
    at /Users/adamfanello/dev/onica/casa/node_modules/jsonc-parser/lib/umd/main.js:3:17
    at ../node_modules/jsonc-parser/lib/umd/main.js (/Users/adamfanello/dev/onica/casa/node_modules/jsonc-parser/lib/umd/main.js:7:107)
    at __require (/Users/adamfanello/dev/onica/casa/cloud/.build/lib/index.js:38:44)
    at ../node_modules/@stoplight/spectral-core/node_modules/@stoplight/json/index.cjs.js (/Users/adamfanello/dev/onica/casa/node_modules/@stoplight/spectral-core/node_modules/@stoplight/json/index.cjs.js:1:194)
    at __require (/Users/adamfanello/dev/onica/casa/cloud/.build/lib/index.js:38:44)

There was an error synthesizing your app.
Hard to find problems in index.js and main.js
t
does running it with
NODE_OPTIONS=--enable-source-maps
help?
a
nope
Copy code
import "source-map-support/register";
doesn't help either
m
Oh I guess it can go under
esbuildConfig
?
No, not there either. You need to expose https://esbuild.github.io/api/#sourcemap
t
this is for the stacks not the functions but yeah I can turn on sourcemaps
wait we do generate sourcemaps for that
m
Oh sorry, guess I wasn't following along 😛