Open JeromeDeLeon opened 1 month ago
Another workaround is to use jiti
inside the config and move .env.local
to .env
for Next.js
application
import { fileURLToPath } from 'url';
import createJiti from 'jiti';
import { defineConfig } from 'kysely-ctl';
const moduleFileUrl = import.meta.url;
const jiti = createJiti(fileURLToPath(moduleFileUrl), {
// Since `jiti` uses isolated environment, we need to provide an alias for the src directory
// See: https://github.com/unjs/jiti/issues/104
alias: { '@': fileURLToPath(new URL('./src', moduleFileUrl)) },
});
const kysely = jiti('./src/path/to/kysely.ts');
export default defineConfig({
kysely,
// other kysely-ctl config
});
I encountered the same issue. Luckily @JeromeDeLeon's workaround works!
Description
Currently, the
kysely.config.ts
file is importing thekysely
instance I created on a separate file and the path is an alias path like@/path/to/kysely
.This throws an error on the CLI.
Looking at
c12
, it looks like it's exposingjitiOptions
which also exposes thealias
to allow alias path.Workaround
Manually configure using
dialect
anddialectConfig
essentially repeating the same logic.Package Info