Skip to content

Introduce a convention for packages to define their auto import patterns #405

@antfu

Description

@antfu

Describe the feature

It doesn't scale well for us to maintain all the presets for every single library. It would also be hard to align the version of each library, especially for major changes.

I propose we have a convention for each library to define its own auto-import entries. For example, a unimport.json file is published along with the npm package. This would make library authors easier to control and maintain the entires, it also naturally solve the problem of version controls.

We already have auto-scan as https://github.com/unjs/unimport#exports-auto-scan, introduced in #104; in the PR, we also mentioned the potential of this but never got implemented. I want to have this PR to bring back the discussion of the design.

A few ideas for the approach:

  • A. unimport.json or dist/unimport.json file.
  • B. meta.unimport field in package.json
  • C. /unimport sub-export (that supports JS)

Additional information

  • Would you be willing to help implement this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions