Skip to content

Commit

Permalink
fix: use resolution version for fetching transient dependencies (#8628)
Browse files Browse the repository at this point in the history
  • Loading branch information
CompuIves authored Oct 3, 2024
1 parent 77e202f commit 2920da5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/sandpack-core/src/npm/dynamic/resolve-dependency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ async function getLatestVersionForSemver(
dep: string,
version: string
): Promise<string> {
if (isAbsoluteVersion(version)) {
return Promise.resolve(version);
}

const p = await getPackageJSON(dep, version);
return JSON.parse(p).version;
}
Expand All @@ -37,10 +41,6 @@ function getAbsoluteVersion(
depVersion: string,
parsedResolutions: { [name: string]: IParsedResolution[] }
): Promise<string> {
if (isAbsoluteVersion(depVersion)) {
return Promise.resolve(depVersion);
}

// Try getting it from the resolutions field first, if that doesn't work
// we try to get the latest version from the semver.
const applicableResolutions = parsedResolutions[depName];
Expand Down Expand Up @@ -106,7 +106,7 @@ async function getDependencyDependencies(
};
await getDependencyDependencies(
depName,
depVersion,
absoluteVersion,
parsedResolutions,
peerDependencyResult
);
Expand Down

0 comments on commit 2920da5

Please sign in to comment.