Execute an external TS file in a T3 Stack app
Hello,
I have my T3 stack up running and I need to execute a ts file
I already searched online and tried using node-ts and tsc but neither work.
Do you have any idea about how I can do this ?
Thanks !
6 Replies
wym executing a file? Executing as in locally in a terminal?
yes, in my case I store information in a db and i need to update all the record of the database but I don't want any access on the app itself just be able to update it by executing a file.
If you need the code of the file I try to execute I can provide it to you !
why didn't ts-node work? did you get an error, or what?
Yes i got an error :
Command :
I got this error :
@bedesqui Do you have any ideas of how I can fix this problem please ?
If you have
"type": "module"
set for the project, maybe running npx ts-node --esm src/scripts/updateFiles.ts
will work
I think ts-node expects cjsThanks @bedesqui
With
"type": module
and npx ts-node --esm src/scripts/updateFiles.ts
I got this error :