#8537·keystone

Keystone CLI ignores tsconfig.json, absolute import paths break keystone build

Author: ThinkscapeCreated May 2, 2023Updated Aug 6, 2025

Background

Repro steps

  1. @keystone-6/core 5.2.0
  2. Have a keystone.ts with config, that includes a relative path (or in any further imported files)

tsconfig.json

javascript
compilerOption: { 
  baseUrl: ".", 
  paths: { "@utils/*" : ["./src/utils/*"] }
}

keystone.ts

typescript
// works when relative
import lists from "../../my/file"

// doesn't work with Keystone CLI when absolute or mapped
import lists from "src/my/file"
import lists from "@utils/my/file"

import { config } from "@keystone-6/core";

export default config({
  lists
  ...
})
  1. Run keystone dev or any command that triggers keystone schema compilation

Expected

Keystone works.

Actual

✨ Starting Keystone
Error: Cannot find module 'src/my/file'
Require stack:
- /Users/thinkscape/app/platform/.keystone/config.js
- /Users/thinkscape/app/platform/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ap_lnbdhzifg6beqfjpgx5jf4wgeq/node_modules/@keystone-
...

That's probably because keystone has its own webpack and tsconfig config used just for schema compilation (and admin build?)