Skip to content
This repository was archived by the owner on Sep 2, 2023. It is now read-only.
This repository was archived by the owner on Sep 2, 2023. It is now read-only.

Conditional exports proposal #401

Closed
Closed
@guybedford

Description

@guybedford

Out of discussion from the last meeting I have just posted a core PR with a conditional exports proposal here - nodejs/node#29978.

This enables e.g. browser mappings in exports, as well as the ability for require() and import to get different modules, as mentioned by @ljharb.

Note that the feature of supporting the "require" condition is something that we can agree to enable or not and is somewhat independent of the proposal.

An interesting consequence of the proposal was that it provides a way to do named exports for CJS packages without getting the instance hazard, as users can effectively write their own wrapper modules.

Hopefully having the proposal fleshed out and implemented allows us to properly discuss these concerns further and decide either way both on the require handling, and on whether we want to support a conditional approach like this for browser mapping or whether we want to leave this problem to userland.

Metadata

Metadata

Assignees

No one assigned

    Labels

    modules-agendaTo be discussed in a meeting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions