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:
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
Jump to solution
16 Replies
MRDGH2821
MRDGH2821•5mo ago
On that note, can you clarify what you actually want to do in the end?🤔😅
kyra
kyra•5mo ago
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 loaded
Solution
kyra
kyra•5mo ago
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
Pat
PatOP•5mo ago
thats awesome thank you 😎 there's a slight error though when checking for tsx so I created (my first ever) pull request
Pat
PatOP•5mo ago
GitHub
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...
kyra
kyra•5mo ago
Oh crap, that's a bug in checkPreloadModules, you don't need another function Can you modify checkPreloadModules and use it instead?
Pat
PatOP•5mo ago
is it? the repo you linked in your pull request also only checks tsx this way
kyra
kyra•5mo ago
It checks tsx by stringifying it Which is really weird tbh
Pat
PatOP•5mo ago
mhm just another way of checking if tsx is a substring but I think the some method is clearer about intent
kyra
kyra•5mo ago
some + includes is fine For both cases
Pat
PatOP•5mo ago
oh yes I see so shall I replace the original function? pushed the update
kyra
kyra•5mo ago
I didn’t remember you could use module as a name Always used mod instead haha Looks good now, yes, thank you!
Pat
PatOP•5mo ago
😄
Pat
PatOP•5mo ago
no polyfill 😎
No description
kyra
kyra•5mo ago
Yoooo!
Want results from more Discord servers?
Add your server