久しぶりに更新しようと思ったら gatsby が動かなくて他の ssg を物色していたのだけど、
最近手に入れた quest3
で遊ぶべく A-Frame
を初めており javascript が活性化されたので、
やはり gatsby
を続けることにした。
以下、修復メモ。
CommonJS Error
すると何かエラーになる。
CommonJSとES Modulesについてまとめる
https://zenn.dev/yodaka/articles/596f441acf1cf3#commonjsのモジュールからesmを呼ぶ
CommonJSのモジュールからESMを呼ぶ
があかんらしい。
gatsby-config.js
が以下のようになっていて CommonJs
なのがよくないらしい。
この辺 A-Frame
やりながら通ったのでだいたいわかる。
ESModule に書き換え。
ES Modules (ESM) and Gatsby | Gatsby
Introduction The ECMAScript module (ESM) format is the official TC39 standard for packaging JavaScript. For many years, CommonJS (CJS…
https://www.gatsbyjs.com/docs/how-to/custom-configuration/es-modules/
conifg-gatsby.js
=> conifg-gatsby.mjs
なおった。