自作モジュールを native ESM 対応するとき、CJS でもエクスポートすることにしたので「Dual package hazard はどのように発生するのか」を試してみました。 問題のあるモジュール test-dual-package-hazard は Approach #2: Isolate state を意識して作成し、main と exports が定義されています。 { "type": "module", "main": "dist/index.cjs", "exports": { "require": "./dist/index.cjs", "import": "./dist/index.js" }, } しかし、index.cjs はモジュールのステートを考慮せずに単純にコードを変換しただけです。つまり関数のインスタンスとともにステータスも分離された状態になっています。