Skip to content

feat(zisi): add zisi_error_cjs_in_esm_scope flag for erroring on misconfigured module type - #7146

Draft
43081j wants to merge 3 commits into
netlify:mainfrom
43081j:jg/cjs-in-esm-goes-boom
Draft

feat(zisi): add zisi_error_cjs_in_esm_scope flag for erroring on misconfigured module type#7146
43081j wants to merge 3 commits into
netlify:mainfrom
43081j:jg/cjs-in-esm-goes-boom

Conversation

@43081j

@43081j 43081j commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

This adds a new zisi_error_cjs_in_esm_scope flag. When enabled, bundling via the nft bundler will error if you have a misconfigured CJS-in-ESM module type.

This basically happens when you have type: "module" but your .js file contains CJS. It should either contain ESM or be named .cjs in that situation.


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures
    we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or
    something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures
    your code follows our style guide and passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 84e68259-9b94-454b-a0bd-9b878a7c15a6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

e18e dependency analysis

No dependency warnings found.

@pkg-pr-new

pkg-pr-new Bot commented Jul 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

@netlify/build

npm i https://pkg.pr.new/@netlify/build@7146

@netlify/build-info

npm i https://pkg.pr.new/@netlify/build-info@7146

@netlify/cache-utils

npm i https://pkg.pr.new/@netlify/cache-utils@7146

@netlify/config

npm i https://pkg.pr.new/@netlify/config@7146

@netlify/edge-bundler

npm i https://pkg.pr.new/@netlify/edge-bundler@7146

@netlify/functions-utils

npm i https://pkg.pr.new/@netlify/functions-utils@7146

@netlify/git-utils

npm i https://pkg.pr.new/@netlify/git-utils@7146

@netlify/headers-parser

npm i https://pkg.pr.new/@netlify/headers-parser@7146

@netlify/api

npm i https://pkg.pr.new/@netlify/api@7146

@netlify/nock-udp

npm i https://pkg.pr.new/@netlify/nock-udp@7146

@netlify/opentelemetry-sdk-setup

npm i https://pkg.pr.new/@netlify/opentelemetry-sdk-setup@7146

@netlify/opentelemetry-utils

npm i https://pkg.pr.new/@netlify/opentelemetry-utils@7146

@netlify/redirect-parser

npm i https://pkg.pr.new/@netlify/redirect-parser@7146

@netlify/run-utils

npm i https://pkg.pr.new/@netlify/run-utils@7146

@netlify/zip-it-and-ship-it

npm i https://pkg.pr.new/@netlify/zip-it-and-ship-it@7146

commit: b5b9086

This flag basically triggers an error when the user tries to bundle a misconfigured project using the nft bundler.

In this situation, a "misconfigured project" is one which has `type: "module"` but contains CJS sources under the `.js` extension.
@43081j
43081j force-pushed the jg/cjs-in-esm-goes-boom branch from b5b9086 to 06eabc8 Compare July 28, 2026 14:39
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.

1 participant