diff --git a/ghost/core/core/cli/command.js b/ghost/core/core/cli/command.js index da0c87dde38..24f841611fa 100644 --- a/ghost/core/core/cli/command.js +++ b/ghost/core/core/cli/command.js @@ -1,3 +1,10 @@ +// Register the tsx CommonJS loader so dev-only CLI commands (generate-data, +// repl, timetravel) can require TypeScript modules directly. These commands run +// via bare `node index.js `, which — unlike `pnpm dev` (nodemon +// --import=tsx) or the production build (tsc) — has no TS resolution otherwise. +// They are restricted to development/local environments, where tsx is available. +require('tsx/cjs'); + const cli = require('@tryghost/pretty-cli'); const logging = cli.ui.log; const chalk = require('chalk');