any reason the esbuild `onEnd` callback doesn’t wo...
# help
s
any reason the esbuild
onEnd
callback doesn’t work/exist in SST’s environment?
{ onResolve: [Function: onResolve], onLoad: [Function: onLoad] }
ahh, old version of esbuild. can we get that upgraded to the latest? without it, it’ll be impossible for me to spit out source + source maps in the correct folder structure I need to upload to Sentry
I tried using
resolutions
in package.json to force it to 0.12.x. well.. that didn’t work out so well when I tried to build the SST app w/ my esbuild plugin (which works fine in a Serverless Framework project).
Copy code
> /Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/esbuild/lib/main.js:233:10: error: "metafile" must be a boolean
    233 │     throw new Error(`"${key}" must be ${mustBe}`);
        ╵           ^
    at getFlag (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/esbuild/lib/main.js:233:11)
    at flagsForBuildOptions (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/esbuild/lib/main.js:345:18)
    at buildOrServeContinue (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/esbuild/lib/main.js:1097:9)
    at /Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/esbuild/lib/main.js:1029:13
without being able to hook into
onEnd
, I can’t think of any good way to get
.js
and
.js.map
files in the right structure. except writing a script that builds a directory tree of my project, and then goes into
.build/cdk.out/assets.*
and whenever it sees a
.map
file, it copies it into a temp folder using the same path of my project.. but this sounds like a mess 😄
t
I'll take a look into this tomorrow since it's blocking you
s
Thank you, much appreciated!
t
And as a bonus I can copy your setup and get sentry source maps fixed in my project
s
I feel like source map support or flexibility is often neglected in frameworks, and it requires significant extra work to get them set up
f
Hey @thdxr not sure it helps, we have an open PR updating esbuild to 0.12.17 - https://github.com/serverless-stack/serverless-stack/pull/623
s
@Frank that would be a HUGE help, seeing as I already have an esbuild plugin written to generate source maps for Sentry. @thdxr feel free to PM me if you want to bounce around ideas on source map support in SST, or test out prototypes, etc
I think a config property in
sst.json
like
"sourcemapOutDir"
or something would be amazing. zero-config source maps.. just dumps everything you need, wherever you want it. very few frameworks make it that easy 😄
t
Will be working on this after lunch - can follow along here: https://github.com/serverless-stack/serverless-stack/issues/700
Made another issue for source map specific stuff - we should discuss exactly what it should do https://github.com/serverless-stack/serverless-stack/issues/701
s
saw the merged PR for the esbuild update - thanks! is that out now in 0.39.0?
ah nvm, last publish was 17 hrs ago
t
It's out now 🙂
s
sweeeeet! 🎉
a thousand thanks 🙂
t
Wait to thank me until it fixes your problem 😂
s
haha. I’ll let you know. and happy to share the esbuild plugin too if it helps you until SST has more robust source map options