grammyjs / examples

Examples to kickstart your journey with grammY.
https://grammy.dev/demo/examples
MIT License
129 stars 33 forks source link

Im trying to use grammy on my next.js project but whatever i do i get this #48

Open MateoKappa opened 7 months ago

MateoKappa commented 7 months ago

`npx ts-node scripts/build.ts

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/mateokappa/Desktop/www/scripts/build.ts at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:160:9) at defaultGetFormat (node:internal/modules/esm/get_format:203:36) at defaultLoad (node:internal/modules/esm/load:141:22) at async nextLoad (node:internal/modules/esm/hooks:865:22) at async nextLoad (node:internal/modules/esm/hooks:865:22) at async Hooks.load (node:internal/modules/esm/hooks:448:20) at async MessagePort.handleMessage (node:internal/modules/esm/worker:196:18) { code: 'ERR_UNKNOWN_FILE_EXTENSION' }`

KnorpelSenf commented 7 months ago

How is this related to grammY?

MateoKappa commented 7 months ago

The build script is from the next.js example from Grammy and I can't run it on my next JS project

KnorpelSenf commented 7 months ago

AFAIK, you don't have to run this command anyway. It will be run automatically during build.

@PonomareVlad is there a way to run these things locally? Should we document it, given that people try it anyway?

MateoKappa commented 7 months ago

It is also failing on vercel , basically I'm trying to fix it locally so it fixes while running on vercel as well

PonomareVlad commented 7 months ago

ts-node doesn't support .ts extension ? 🌚

keyding commented 2 months ago

I had the same error, and switched from ts-node to tsx.

But if you want to use ts-node, see this issue: https://github.com/TypeStrong/ts-node/issues/2100

Also, you can just use Bun, it's very fast.

You can do this: bun run scripts/build.ts, not required ts-node.