Skip to content

Conversation

@RyanCavanaugh
Copy link
Member

Fixes #18630 which regressed at #18326.

When we look for a node module of the form foo/bar it's correct to look in foo for a package.json but not foo/bar/package.json. This is not the case for @foo/bar; we do need to look for @foo/bar/package.json.

Essentially any scoped package name @foo/bar needs to be treated as if they are fully atomic, hence the change in getNameOfTopDirectory

@ghost
Copy link

ghost commented Sep 21, 2017

Looks similar to #18580?

const rest = name.slice(idx + 1);
// Scoped packages should be treated as a distinct unit
if (top[0] === '@') {
return { top: name, rest: "" };
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For @foo/bar/baz we want to return { top: "@foo/bar", rest: "baz" }.

@RyanCavanaugh
Copy link
Member Author

Yep

@RyanCavanaugh RyanCavanaugh deleted the fixJsModuleResolution branch September 21, 2017 02:24
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants