Skip to content

TypeScript + Fastify + ES modules + Node-TS demo repo

License

Notifications You must be signed in to change notification settings

melroy89/fastify-node-ts-swc-demo

Repository files navigation

TypeScript + Fastify ESM + Node-TS Demo

Working TypeScript + SWC + Fastify + ES Modules + Node-TS demo. See workaround below.

First install deps via: npm install

Try to excute: npm run dev (this will use Node-TS + SWC)

Or run: npm start

Finally, go to: http://localhost:3000

A fast build using SWC, run: npm run build. If you want to use TSC compiler use: npm run build:prod, which does validate types.


WORKAROUND: We currently apply a workaround by setting VITEST=true to force ESM in Fastify-autoloader. So npm run dev is using:

FASTIFY_AUTOLOAD_TYPESCRIPT=1 VITEST=true node --no-warnings=ExperimentalWarning --loader ts-node/esm src/index.ts