Skip to content

Commit

Permalink
fix: webpack before native
Browse files Browse the repository at this point in the history
  • Loading branch information
sverweij committed Nov 21, 2023
1 parent 78990e0 commit 2f29ace
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/extract/resolve/module-classifiers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ export function getAliasTypes(
if (isRelativeModuleName(pModuleName)) {
return [];
}
if (isWebPackAliased(pModuleName, pResolveOptions.alias)) {
return ["aliased", "aliased-webpack"];
}
// the order of these ifs is deliberate - node native stuff first, then things
// bolted on by bundlers & transpilers. The order of subpath imports and workspaces
// isn't _that_ important, as they can't be confused
Expand All @@ -230,9 +233,6 @@ export function getAliasTypes(
if (isWorkspaceAliased(pModuleName, pResolvedModuleName, pManifest)) {
return ["aliased", "aliased-workspace"];
}
if (isWebPackAliased(pModuleName, pResolveOptions.alias)) {
return ["aliased", "aliased-webpack"];
}
if (
isLikelyTSAliased(
pModuleName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ describe("[I] extract/resolve/module-classifiers - getAliasTypes", () => {
);
});

it("classifies as a workspace alias if it could be both a web pack alias _and_ a workspace alias", () => {
it("classifies as a webpack alias if it could be both a webpack alias _and_ a workspace alias", () => {
const lManifest = {
name: "test",
version: "1.0.0",
Expand All @@ -256,11 +256,11 @@ describe("[I] extract/resolve/module-classifiers - getAliasTypes", () => {
lResolveOptions,
lManifest,
),
["aliased", "aliased-workspace"],
["aliased", "aliased-webpack"],
);
});

it("classifies as a subpath import if it could be both a web pack alias _and_ a subpath import", () => {
it("classifies as a webpack alias if it could be both a webpack alias _and_ a subpath import", () => {
const lManifest = {
name: "test",
version: "1.0.0",
Expand All @@ -281,7 +281,7 @@ describe("[I] extract/resolve/module-classifiers - getAliasTypes", () => {
lResolveOptions,
lManifest,
),
["aliased", "aliased-subpath-import"],
["aliased", "aliased-webpack"],
);
});

Expand Down

0 comments on commit 2f29ace

Please sign in to comment.