You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An issue or task that is ideal for new open source contributors.
Please reach out to the issue creator before claiming an issue to discuss design.
Description
Similar to the "exports" field, the package.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 — therefore we can treat this value as a new import specifier to resolve() relative to the package path.
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 inside metro-resolver.
Add a new experimental config option, resolver.unstable_enablePackageImports.Update: Ideally we can skip this, and add as one PR with decent test coverage.
Update the PackageJson type to accept an optional imports property. This should be of type ExportMap.
@huntie : thanks for the detailed description, for now its good enough to get me started! for more questions I'll paste comments here!
Could you please assign this issue to me?
@huntie From the discussion in the linked pull request, I think this issue is up for grabs? (cc: @kraenhansen ) Or maybe @kraenhansen was interested in picking it up?
Either way, I've had a go at this myself here: #1302 – please feel free to check it out and see if the changes there are on the right path 😄 - I managed to get some basic tests to pass 🎉
👋🏻 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 — therefore 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: