Skip to content

Supporting CommonJS subpaths #20

@guybedford

Description

@guybedford

This is kind of the main drawback of this proposal, and I'm just wondering if there might not be a way to handle it.

Currently the switch is treated as "if there is no 'module' or 'default.js' and there is a "main" or index.js then load the 'main' or 'index.js' as CommonJS"

What if we extended the switch to subpaths: "if there is no 'module' or 'default.js' and there is a 'main' or 'index.js', then treat subpath requires as CommonJS".

This still retains the value of this proposal in not imposing a flag on users, while still supporting the expected workflows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions