mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-09 21:07:46 +00:00
fix corepack detection for package manager version determination (#11596)
The previous logic was checking for the env var `ENABLE_EXPERIMENTAL_COREPACK` to determine if corepack was being used by a project. However, this value only means that the build system should consider corepack, not that it's actively being used. We need to check that flag AND the existence of a `packageManager` property in the project's `package.json`.
This commit is contained in:
@@ -104,8 +104,13 @@ export const build: BuildV2 = async ({
|
||||
meta
|
||||
);
|
||||
|
||||
const { cliType, packageJsonPath, lockfileVersion, lockfilePath } =
|
||||
await scanParentDirs(entrypointFsDirname);
|
||||
const {
|
||||
cliType,
|
||||
packageJsonPath,
|
||||
packageJson,
|
||||
lockfileVersion,
|
||||
lockfilePath,
|
||||
} = await scanParentDirs(entrypointFsDirname, true);
|
||||
|
||||
if (!packageJsonPath) {
|
||||
throw new Error('Failed to locate `package.json` file in your project');
|
||||
@@ -125,6 +130,7 @@ export const build: BuildV2 = async ({
|
||||
spawnOpts.env = getEnvForPackageManager({
|
||||
cliType,
|
||||
lockfileVersion,
|
||||
packageJsonPackageManager: packageJson?.packageManager,
|
||||
nodeVersion,
|
||||
env: spawnOpts.env,
|
||||
});
|
||||
|
||||
@@ -99,6 +99,7 @@ export const build: BuildV2 = async ({
|
||||
spawnOpts.env = getEnvForPackageManager({
|
||||
cliType,
|
||||
lockfileVersion,
|
||||
packageJsonPackageManager: packageJson?.packageManager,
|
||||
nodeVersion,
|
||||
env: spawnOpts.env,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user