Skip to content

The default export condition must come last #7

Description

@DamienCassou

When package.json is generated, the conditional exports are in the wrong order: "default" must be the last one.

The example is from https://github.com/atomicojs/hooks. Here is what is generated:

{
  "exports": {
    ".": {
      "default": "./dist/index.js",
      "types": "./dist/index.d.ts"
    }
  }
}

Here is what is expected instead:

{
  "exports": {
    ".": {
      "types": "./dist/index.d.ts",
      "default": "./dist/index.js"
    }
  }
}

This is a problem because webpack crashes if the default doesn't come last: https://github.com/webpack/enhanced-resolve/blob/v5.15.0/lib/util/entrypoints.js#L475.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions