(node:81970) Warning: To load an ES module, set “type”: “module” in the package.json or use the .mjs extension.

nestjsでAPIを構築していたら、タイトルのエラーが発生しました。

調べてみましたところ、

  • 実行時に–experimental-modulesを指定
  • package.jsonにtypeを追加

する事で解決できるらしいです

修正後のpackage.json

参考記事

【ECMAScript】importでSyntaxError