Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/melroy89/fastify-node-ts-swc-demo
TypeScript + Fastify + ES modules + Node-TS demo repo
https://github.com/melroy89/fastify-node-ts-swc-demo
es6 es6-modules esm esmodules fastify fastify-autoload node-ts nodejs swc typescript
Last synced: 18 days ago
JSON representation
TypeScript + Fastify + ES modules + Node-TS demo repo
- Host: GitHub
- URL: https://github.com/melroy89/fastify-node-ts-swc-demo
- Owner: melroy89
- License: mit
- Created: 2024-03-15T17:38:07.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-10-19T10:10:43.000Z (3 months ago)
- Last Synced: 2024-11-09T14:23:37.709Z (2 months ago)
- Topics: es6, es6-modules, esm, esmodules, fastify, fastify-autoload, node-ts, nodejs, swc, typescript
- Language: TypeScript
- Homepage:
- Size: 188 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TypeScript + Fastify ESM + Node-TS Demo
Working [TypeScript](https://www.typescriptlang.org/) + [SWC](https://swc.rs/) + [Fastify](https://fastify.dev/) + ES Modules + [Node-TS](https://www.npmjs.com/ts-node) 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](https://swc.rs/), 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](https://github.com/fastify/fastify-autoload). So `npm run dev` is using:
```sh
FASTIFY_AUTOLOAD_TYPESCRIPT=1 VITEST=true node --no-warnings=ExperimentalWarning --loader ts-node/esm src/index.ts
```