Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(init): adds 'module' field to enhancedResolve mainFields when current module is type:module #846

Merged

Conversation

sverweij
Copy link
Owner

Description

  • If the current package.json contains a type attribute with the value module add module to the list of mainFields enhanced resolve should use in its (external) module resolution.
  • Makes the default mainFields ['main', 'types', 'typings'] over just ['main'] (or a comment) as it's always useful in TypeScript project (which is likely in the majority of all JavaScript projects out there) and doesn't hurt in other contexts.

Additionally, a separate commit, outside this PR, documents the working of the mainFields attribute for ESM contexts (b92b79b)

Motivation and Context

#843

How Has This Been Tested?

  • green ci
  • additional automated tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation only change
  • Refactor (non-breaking change which fixes an issue without changing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • 📖

    • My change doesn't require a documentation update, or ...
    • it does and I have updated it
  • ⚖️

    • The contribution will be subject to The MIT license, and I'm OK with that.
    • The contribution is my own original work.
    • I am ok with the stuff in CONTRIBUTING.md.

@codeclimate
Copy link

codeclimate bot commented Sep 29, 2023

Code Climate has analyzed commit 757fca4 and detected 0 issues on this pull request.

View more on Code Climate.

@sverweij sverweij merged commit 32cad15 into main Sep 29, 2023
7 checks passed
@sverweij sverweij deleted the feature/init-adds-module-to-mainfields-for-type-module branch September 29, 2023 13:21
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.

None yet

1 participant