mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-03 16:46:00 +00:00
fix(cli): support loading bknd.config.ts and detect runtime mismatch
Add jiti to handle TypeScript config imports natively in the CLI, removing the need for npx tsx or --experimental-strip-types workarounds. Detect Bun adapter usage under Node and suggest running CLI with the correct runtime. Closes #360
This commit is contained in:
@@ -112,7 +112,14 @@ export async function makeAppFromEnv(options: Partial<RunOptions> = {}) {
|
||||
const config = await loadConfigFile(configFilePath);
|
||||
app = await makeConfigApp(config, options.server);
|
||||
} catch (e) {
|
||||
console.error("Failed to load config:", e);
|
||||
if (e instanceof ReferenceError && e.message === "Bun is not defined") {
|
||||
console.error(
|
||||
c.red("Your config imports from a Bun-specific adapter, but the CLI is running under Node."),
|
||||
`\nRun with Bun instead:\n\n ${c.cyan("bun node_modules/.bin/bknd")} ${c.dim(process.argv.slice(2).join(" "))}\n`,
|
||||
);
|
||||
} else {
|
||||
console.error("Failed to load config:", e);
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user