Good way to run single file script with NextJS

Is there a good way to run single file script without starting the webserver in a nextjs project and utilizing prisma/other server side features? Similar to django management commands (if you are familiar with python/django). I have tried using tsx but I am running into many small issues mostly related to tsconfig/module importing etc.
2 Replies
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View
Amit
Amit16mo ago
@kapobajza thanks a lot, let me try that I tried this. I was running into some errors again such as "SyntaxError: Cannot use import statement outside a module ". Adding
"ts-node": {
"compilerOptions": {
"module": "CommonJS"
}
}
"ts-node": {
"compilerOptions": {
"module": "CommonJS"
}
}
to tsconfig.json, fixed it.