nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨

Home Page:https://nodejs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Default `--experimental-detect-module` to `commonjs` in require hooks

RedYetiDev opened this issue · comments

When detect-module is enabled by default (as seen in this image), we're encountering failures in several tests from test/es-module. While most of these failures are expected due to the changes, two of them are not:

These errors seem to be related to how the format context property is defined. We've attempted various solutions, but we're seeking input on the next steps on how to properly define this property.

Some ideas we're considering:

  1. Ensure format is always defined: We could make sure format is never undefined, even if we don't know what it should be.

    • Pros:
      • Eliminates concerns about different edge cases for return types.
      • Avoids the need to redefine format multiple times internally.
    • Cons:
      • If we don't know the format, what value should we set it to?
  2. Distinguish null and undefined formats: Specifically for this use case, we could differentiate between null and undefined formats.

    • Pros:
      • Could work well for our purposes.
      • Requires minimal effort to implement.
    • Cons:
      • Maintenance could be challenging, as future changes would need to understand this distinction.

Do you have any insights or suggestions on these approaches, or perhaps an alternative solution we haven't considered?

Would this be a good first issue?

Personally, I don't think this would be a good first issue, as it's a complex issue to tackle, but you can always try it.

Most good first issues have been labeled as "good first issue"

(Will be) Fixed by #53044