fix(cli): support loading bknd.config.ts without tsx workaround

Add jiti as a dependency to handle TypeScript config imports natively in the CLI, removing the need for npx tsx or --experimental-strip-types workarounds.

Closes #360
This commit is contained in:
Cameron Pak
2026-03-07 08:06:51 -06:00
parent 7832328a50
commit e6b17f6424
4 changed files with 16 additions and 28 deletions
@@ -95,28 +95,7 @@ export default {
The `app` function is useful if you need a cross-platform way to access the environment variables. For example, on Cloudflare Workers, you can only access environment variables inside a request handler. If you're exclusively using a node-like environment, it's safe to access the environment variables directly from `process.env`.
If you're using `npx bknd run`, make sure to create a file in a file format that `node` can load, otherwise you may run into an error that the file couldn't be found:
```
[INF] 2025-03-28 18:02:21 Using config from bknd.config.ts
[ERR] 2025-03-28 18:02:21 Failed to load config: Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'bknd.config.ts' imported from [...]
at packageResolve (node:internal/modules/esm/resolve:857:9)
at [...] {
code: 'ERR_MODULE_NOT_FOUND'
}
```
If you still want to use a `.ts` extension, you can start the CLI e.g. using `node` (>=v22.6.0):
```sh
node --experimental-strip-types node_modules/.bin/bknd run
```
Or with `tsx`:
```sh
npx tsx node_modules/.bin/bknd run
```
TypeScript configuration files (`.ts`) are fully supported and work out of the box with `npx bknd run` — no additional flags or tools required.
### Turso/LibSQL database