#16838·medusa

[Bug]: medusa build breaks with TypeScript 7 (config loader: Cannot read properties of undefined (reading 'fileExists'))

Author: aborgxCreated Sep 16, 2026Updated Sep 16, 2026
Labelstype: bughelp-wanted

Describe the bug

medusa build fails when the project uses TypeScript 7.0.2 (the native/Go compiler) as typescript devDependency. The config loader in @medusajs/utils (getConfigFiledynamicImport, which transpiles medusa-config.ts via ts-node) throws:

TypeError: Cannot read properties of undefined (reading 'fileExists')
    at getConfigFile (node_modules/@medusajs/utils/dist/common/get-config-file.js:16:74)

which then surfaces as Error: Cannot find module 'apps/api/medusa-config'.

With TypeScript 5.9.3 the same project builds fine. Pure tsc typechecking under TS 7 passes; only the framework's runtime transpilation of the config file breaks.

Minimal reproduction

  • Medusa 2.21.0
  • typescript: 7.0.2 in devDependencies
  • run medusa build

Expected behavior

Either the config loader supports the TS7 toolchain, or Medusa declares the supported TypeScript range so users don't discover this at build time.

Environment

  • Medusa 2.21.0, Node 22, Windows (WSL) and Linux CI