How do I get SST to build with proper sourcemaps? ...
# sst
d
How do I get SST to build with proper sourcemaps? My stacktrace in seed.run issues are minified.
index.js and index.js.map are in the Lambda
visible in AWS console
t
Haven’t personally tried it but I think you need to add this env
Copy code
NODE_OPTIONS=--enable-source-maps
d
thanks, so it’s not on by default?
I’ll try adding this to the deployed Lambda env vars
t
I have no idea 🤷 lmk what you find!
t
I haven't actually looked into sourceMaps yet
I know some people were using a library
d
do I have to add the npm package and that’s it?
wait already have
"source-map-support"
in package.json
t
I think it needs to be required or something. I haven't used it yet
t
I thought that was only for pre node 12
t
I'm totally inexperienced so I'm probably wrong
t
looks like both would work, don’t know which is best though
d
I set
NODE_OPTIONS: '--enable-source-maps',
in every function
environment
and it seems to work, thanks!
t
Nice! Any downsides of doing this? Like a performance hit. If not @thdxr would it be possible to make this an sst default?
t
I've actually been somewhat confused by this
What's the point of minifying if we ship the source map anyway
t
the source map helps because the code is bundled right?
d
bundling
and ts => js
t
I guess it's also transpiled
Yeah
Ok that makes sense, it's more the minification I'm confused about
Is it worth minifying if we're gonna ship the source map
d
startup time?
t
The startup time is the function downloading the whole code bundle. So if you ship the sourcemap alongside you're losing the benefits
There may be some minor parsing benefits but can't imagine it's huge
d
and parsing and jitting
yea tiny but on lower ram lambdas maybe helps
t
I guess we can leave it and as long as we're defaulting to enabling sourceMaps no one will have to be exposed to that detail
Apparently it does come with performance impacts, need to do some research
Seeing some comments that startup time is slowed