Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Cypress configs are CommonJS under root "type": "module" and will fail to load

オープン 初心者向け
#2,224 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 4 日以内に返信

@JohnyKid123 がすでに取り組んでいます。

2026年10月13日 から。

  • #2239 @JohnyKid123 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cypress, javascript, node.js
領域
testing

調査の方向性

まずルートの package.json と cypress/plugins/index.js を読み、issueで説明されているモジュール型の競合を確認してください。Cypressプラグインファイルがどのように読み込まれるかを確認してから、提案されている1行の修正のいずれかを選んでください。ルートのESM設定でプラグインが関数として読み込まれれば完了です。記載されているNodeコマンド、または適切なCypressのチェックで確認してください。

索引モデルが issue の本文から書いたものです。

説明

Found while verifying #2221. Not a regression from that PR — it's pre-existing and currently latent, since no CI job runs Cypress.

The problem

Root package.json declares "type": "module" (re-added in f42f6fce, the ESM test-suite migration). That makes Node treat every .js under the repo root as ESM — including cypress/plugins/index.js, which is still CommonJS (module.exports = (on, config) => {...}).

cypress/support/index.js is comments-only today, so it's currently harmless, but it's in the same trap the moment anyone adds code to it.

Verified on development with Node v24.14.0:

$ node -e "console.log(typeof require('./cypress/plugins/index.js'))"
object

require() returns an empty namespace object instead of the exported function, so anything that loads the plugins file the way Cypress does will get a non-function — the same failure #2221 fixes for github-actions/pr-instructions/.

Suggested fix

Pick one, all are one-liners:

  • rename cypress/plugins/index.js → cypress/plugins/index.cjs (what #2221 does), or
  • add cypress/package.json containing { "type": "commonjs" } to scope the subtree back to CJS, or
  • relocate the file under a directory that already has a CJS package.json.

The cypress/package.json route is the more durable one, since it protects future files added under cypress/ automatically.

Not affected — checked already

  • shared/roles.js and shared/authorizationUtils.js also contain module.exports, but they're guarded with if (typeof module !== "undefined" && module.exports) and import each other as ESM, so they load correctly either way.
  • backend/ has its own package.json with "type": "module".
  • client/ has no type field, so its CJS configs (postcss.config.js, tailwind.config.js, setupProxy.js) are fine.

The only real breakage in the root tree is the Cypress plugins file.

主要言語
JavaScript
スター
62
フォーク
106
平均マージ
3日 19時間
マージ済み PR(30日)
5

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

hackforla/VRMS のほかの issue

hackforla/VRMS の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。