Skip to content

Conversation

@ainsleyclark
Copy link
Contributor

Payload apps have "type": "module" in package.json, which treats all .js files as ES modules. The dependency check script uses CommonJS (require), causing a ReferenceError at runtime.

Changes:

  • Rename check-deps.js to check-deps.cjs
  • Update all references to use .cjs extension
  • Update tests to expect .cjs filename

This fixes the "require is not defined in ES module scope" error.

Payload apps have "type": "module" in package.json, which treats all
.js files as ES modules. The dependency check script uses CommonJS
(require), causing a ReferenceError at runtime.

Changes:
- Rename check-deps.js to check-deps.cjs
- Update all references to use .cjs extension
- Update tests to expect .cjs filename

This fixes the "require is not defined in ES module scope" error.
@codecov
Copy link

codecov bot commented Jan 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.53%. Comparing base (7f6b060) to head (c7767b4).
⚠️ Report is 441 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #361      +/-   ##
==========================================
+ Coverage   64.59%   69.53%   +4.94%     
==========================================
  Files         154      185      +31     
  Lines        6064     7294    +1230     
==========================================
+ Hits         3917     5072    +1155     
+ Misses       2064     2025      -39     
- Partials       83      197     +114     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ainsleyclark ainsleyclark merged commit 9a2c96f into main Jan 2, 2026
5 of 6 checks passed
@ainsleyclark ainsleyclark deleted the claude/fix-esm-commonjs-issue-ZMyoa branch January 2, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants