https://serverless-stack.com/ logo
#sst
Title
# sst
b

Blake E

09/03/2021, 9:05 PM
I’m curious why we build our own path to
.bin/tsc
in cdkHelpers.ts vs. letting the system resolve this using $PATH? or other node module resolution strategies? I believe my latest mono-repo issue (rushjs, which symlinks
node_modules
) deals with this “custom” module command resolution for
tsc
I presume it’s to use your own
typescript
dependency’s
.bin/tsc
I presume? to keep framework in sync and building properly etc?
f

Frank

09/03/2021, 11:05 PM
Hey @Blake E, yeah the function pretty much looks up the path to the
tsc
executable in the node_modules by doing a require.
b

Blake E

09/07/2021, 3:18 PM
yeah, wondering why this is required to find path in-code vs. using node_module default resolution - (w/o knowing the wherefores here) I’d suggest a more vanilla approach which would move closer native support for pnpm and rushjs. In the meantime, I can probably work-around by symlinking to expectant folder structure
f

Frank

09/07/2021, 7:44 PM
@Jay might be more familiar on this. From what I gathered, it seems by doing a
required
, it is using the node_module’s default resolution?
b

Blake E

09/07/2021, 7:46 PM
well, suffice it to say, my
tsc
is not in the location that is expected,
Copy code
/**
 * Finds the path to the tsc package executable by converting the file path of:
 * /Users/spongebob/serverless-stack/node_modules/typescript/dist/index.js
 * to:
 * /Users/spongebob/serverless-stack/node_modules/.bin/tsc
 */
pnpm
and rushjs.io use symlinks to create a single folder of installed packages (to avoid phantom dependencies) and symlinks into
node_modules
. I’m not full read into the default module resolution spec that node implements (yet), but my
tsc
is not located in folder beside
typescript
. I can get the error and be more specific about my issues (I’ve already worked around it so will need to backtrack)
I guess, I’m just always weary when building these paths outside of node itself, as node has a full spec for package discovery. I imagine the use of
require.resolve
should’ve accounted for this, but yeah - I don’t think ya’ll need to worry about this for now.
I was just hoping to understand why the path seeking in the first place, so my work-around(s) patch(es) don’t ignore something important.
f

Frank

09/08/2021, 2:42 AM
Ah I see. Yeah that makes sense. We want to support pnpm and rushjs down the road. Or at least make SST more extensible.
3 Views