voorhoede / head-start

Base setup on top of headless services to help you quickly start a new website
ISC License
3 stars 0 forks source link

Bug: DatoCMS migrations don't run #62

Open jbmoelker opened 8 months ago

jbmoelker commented 8 months ago

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.