You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the kysely.config.ts file is importing the kysely 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 exposing jitiOptions which also exposes the alias to allow alias path.
ERROR Cannot find module '@/path/to/kysely'
Require stack:
- /repo/kysely.config.ts
Require stack:
- kysely.config.ts
at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
at Function.resolve (node:internal/modules/helpers:190:19)
at _resolve (node_modules/jiti/dist/jiti.js:1:241814)
at jiti (node_modules/jiti/dist/jiti.js:1:244531)
at kysely.config.ts:2:15
at evalModule (node_modules/jiti/dist/jiti.js:1:247313)
at Object.jiti (node_modules/jiti/dist/jiti.js:1:245241)
at resolveConfig (node_modules/c12/dist/shared/c12.cab0c9da.mjs:345:26)
at loadConfig (node_modules/c12/dist/shared/c12.cab0c9da.mjs:147:29)
at async getConfig (node_modules/kysely-ctl/dist/bin.js:226:24)
Workaround
Manually configure using dialect and dialectConfig essentially repeating the same logic.
Package Info
kysely v0.27.4
kysely-ctl v0.9.0
The text was updated successfully, but these errors were encountered:
Another workaround is to use jiti inside the config and move .env.local to .env for Next.js application
import{fileURLToPath}from'url';importcreateJitifrom'jiti';import{defineConfig}from'kysely-ctl';constmoduleFileUrl=import.meta.url;constjiti=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/104alias: {'@': fileURLToPath(newURL('./src',moduleFileUrl))},});constkysely=jiti('./src/path/to/kysely.ts');exportdefaultdefineConfig({
kysely,// other kysely-ctl config});
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
The text was updated successfully, but these errors were encountered: