storyblok-cli icon indicating copy to clipboard operation
storyblok-cli copied to clipboard

`run-migration` is broken after ESM migration

Open privetkuku opened this issue 9 months ago • 3 comments

Current behavior:

  • Generate migration. It will produce .js file with export default ESM statement
  • Run run-migration. Error will be thrown, because Node.js didn't expect to see ESM export in .js file

Expected behavior:

  • Migration is executed without error

Steps to reproduce: Steps are described in Current behaviour section.

Related code: Code that broke the functionality - https://github.com/storyblok/storyblok-cli/commit/891af62c7a628286f507299b19128a2193a55550#diff-2c9538c486ae6103ef79ac65657bf841191ae869f4992158328e6739c28e463c

Other information: To fix the issue, you need to generate .mjs files, not .js. Current "fix" for me is to use --experimental-detect-module flag, but that's not safe.

privetkuku avatar May 13 '24 08:05 privetkuku