-
Notifications
You must be signed in to change notification settings - Fork 598
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: package.json "imports" field #978
Comments
Hello @huntie |
Hey @siddarthkay! I've added a description now. If you're still happy to take this on, let me know :) (and feel free to DM me on Twitter). |
@huntie : thanks for the detailed description, for now its good enough to get me started! for more questions I'll paste comments here! |
馃憢馃徎 Good First Issue
Description
Similar to the
"exports" field
, thepackage.json
"imports"
field is a mapping of private import specifiers (from any modules in that package) to a given target.Unlike
"exports"
, a target in this case can be either a subpath to a file contained within a package, OR a bare import specifier 鈥斅爐herefore we can treat this value as a new import specifier toresolve()
relative to the package path.Rough design
This is a significant new feature(!), but is well-described by the spec and relatively isolated. If picking up this task, @huntie and a backup Metro team member will be available to support via DM throughout the time spent on this feature.
Most of the implementation for
"imports"
should live insidemetro-resolver
.Add a new experimental config option,Update: Ideally we can skip this, and add as one PR with decent test coverage.resolver.unstable_enablePackageImports
.imports
property. This should be of typeExportMap
.#
. This should call new logic in aPackageImportsResolve.js
module (that follows thePACKAGE_IMPORTS_RESOLVE
function in the Node Resolution Algorithm).PackageImportNotDefinedError
.resolve.js
should then return the result ofresolve(target)
.Notes:
"imports"
should be handleable with the existing config options andreduceExportMap()
function.The text was updated successfully, but these errors were encountered: