Is it possible to use my own LoaderStrategy?
I want to add support for tsx. Currently I've got it working by editing the LoaderStrategy file in node_modules and setting
shouldLoadTsFiles
to true
. Is there a way to do this using sapphire?Solution:Jump to solution
GitHub
feat: check for more environments for TS support by kyranet · Pull ...
Added the following:
@babel/node
@swc/cli
esbuild
jest
tsm
tsx
vitest
On top of the existing:
Deno
Bun
ts-node
16 Replies
On that note, can you clarify what you actually want to do in the end?🤔😅
That won't be needed soon, I'm expanding the list of things
@sapphire/pieces
checks to determine whether or not TypeScript files can be directly loadedSolution
GitHub
feat: check for more environments for TS support by kyranet · Pull ...
Added the following:
@babel/node
@swc/cli
esbuild
jest
tsm
tsx
vitest
On top of the existing:
Deno
Bun
ts-node
thats awesome thank you 😎
there's a slight error though when checking for
tsx
so I created (my first ever) pull requestGitHub
fix: fixed checking for tsx support by AhsokaT · Pull Request #416 ...
Added
function checkPreloadModulesSubstring
Small fix for TS environment support. tsx has to be searched as a substring when it's present in process._preload_modules as the string takes a for...
Oh crap, that's a bug in
checkPreloadModules
, you don't need another function
Can you modify checkPreloadModules
and use it instead?is it? the repo you linked in your pull request also only checks
tsx
this wayIt checks tsx by stringifying it
Which is really weird tbh
mhm just another way of checking if
tsx
is a substring but I think the some
method is clearer about intentsome
+ includes
is fine
For both casesoh yes I see
so shall I replace the original function?
pushed the update
I didn’t remember you could use
module
as a name
Always used mod
instead haha
Looks good now, yes, thank you!😄
no polyfill 😎
Yoooo!