Trying to run the autogenerated migrations on a new environment throws an error:
Running migration "1691503643_addTranslations.ts"... !
Error: Must use import to load ES Module: /path/to/voorhoede/head-start/config/datocms/migrations/1691503643_addTranslations.ts
require() of ES modules is not supported.
require() of /Users/jasper/code/voorhoede/head-start/config/datocms/migrations/1691503643_addTranslations.ts from
/Users/jasper/code/voorhoede/head-start/node_modules/@datocms/cli/lib/commands/migrations/run.js is an ES module file as it is a .ts file whose nearest parent package.json contains
"type": "module" which defines all .ts files in that package scope as ES modules.
Instead change the requiring code to use import(), or remove "type": "module" from /path/to/voorhoede/head-start/package.json.
Code: ERR_REQUIRE_ESM
The migrations are auto-generated using npx datocms:new --autogenerate=... with format set to TypeScript. However our setup seems to cause an issue between what Astro and what DatoCMS expect in terms of tsconfig.json and package.json > type.
Trying to run the autogenerated migrations on a new environment throws an error:
The migrations are auto-generated using
npx datocms:new --autogenerate=...
with format set to TypeScript. However our setup seems to cause an issue between what Astro and what DatoCMS expect in terms oftsconfig.json
andpackage.json
>type
.