diff --git a/packages/expo/src/executors/build/build.impl.ts b/packages/expo/src/executors/build/build.impl.ts index f93b5914a1f3c..0c57b34f7e101 100644 --- a/packages/expo/src/executors/build/build.impl.ts +++ b/packages/expo/src/executors/build/build.impl.ts @@ -143,6 +143,17 @@ function copyPackageJsonAndLock( projectPackageJson.dependencies = rootPackageJsonDependencies; projectPackageJson.devDependencies = rootPackageJsonDevDependencies; + const projectOverrides = projectPackageJson.overrides; + const projectResolutions = projectPackageJson.resolutions; + + if (rootPackageJson.overrides) { + projectPackageJson.overrides = rootPackageJson.overrides; + } + // if overrides exists, give precedence to it over resolutions + if (!rootPackageJson.overrides && rootPackageJson.resolutions) { + projectPackageJson.resolutions = rootPackageJson.resolutions; + } + // Copy dependencies from root package.json to project package.json writeJsonFile(packageJsonProject, projectPackageJson); @@ -153,6 +164,18 @@ function copyPackageJsonAndLock( // Reset project package.json to original state projectPackageJson.dependencies = projectPackageJsonDependencies; projectPackageJson.devDependencies = projectPackageJsonDevDependencies; + + if (projectOverrides) { + projectPackageJson.overrides = projectOverrides; + } else { + delete projectPackageJson.overrides; + } + if (projectResolutions) { + projectPackageJson.resolutions = projectResolutions; + } else { + delete projectPackageJson.resolutions; + } + writeFileSync( packageJsonProject, JSON.stringify(projectPackageJson, null, 2)