Keystone CLI ignores tsconfig.json, absolute import paths break keystone build
Author: ThinkscapeCreated May 2, 2023Updated Aug 6, 2025
Background
- Mentioned here https://github.com/keystonejs/keystone/issues/8143#issuecomment-1340931482
- Reported in slack https://keystonejs.slack.com/archives/C01STDMEW3S/p1682573272390949
Repro steps
@keystone-6/core 5.2.0- Have a
keystone.tswith config, that includes a relative path (or in any further imported files)
tsconfig.json
compilerOption: {
baseUrl: ".",
paths: { "@utils/*" : ["./src/utils/*"] }
}keystone.ts
// 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
...
})- Run
keystone devor 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?)
Source: keystonejs/keystone