#Config file not recognizing typescript when upgrading Payload to latest version

3 messages · Page 1 of 1 (latest)

tribal pawn
#

I am upgrading Payload from 3.0.0-beta.127 to 3.11.0 (and fixing all the manual breaking in between).

I ran into an issue where I could not run any payload commands using script: "payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload"

I would get numerous errors around Typescript ESM features in my payload.config.ts. Syntax Errors around unrecognized typescript features like as as well as imports failing using cusotmTypescripty import paths.

tribal pawn
#

✅ The fix is to add "type": "module", to your package.json. I also updated the tsconfig.json to match the one generated by a new create-payload-app project.

After this, all the payload commands work normally and my payload.config.ts file is parsed correctly again without any changes.

Just self-documenting this issue.