зеркало из https://github.com/microsoft/rnx-kit.git
fix(metro-config): fix `@react-native/metro-config` not being resolved (#2779)
This commit is contained in:
Родитель
067e2ed747
Коммит
a5ec943ab8
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@rnx-kit/metro-config": patch
|
||||
---
|
||||
|
||||
Fix `@react-native/metro-config` not being resolved correctly in a pnpm setup
|
|
@ -109,7 +109,10 @@ function getDefaultConfig(projectRoot) {
|
|||
const manifest = fs.readFileSync(pkgJson, { encoding: "utf-8" });
|
||||
if (manifest.includes("@react-native/metro-config")) {
|
||||
// @ts-ignore Cannot find module or its corresponding type declarations.
|
||||
const { getDefaultConfig } = require("@react-native/metro-config");
|
||||
const metroConfigPath = require.resolve("@react-native/metro-config", {
|
||||
paths: [projectRoot],
|
||||
});
|
||||
const { getDefaultConfig } = require(metroConfigPath);
|
||||
const { getAvailablePlatforms } = require("@rnx-kit/tools-react-native");
|
||||
|
||||
const defaultConfig = getDefaultConfig(projectRoot);
|
||||
|
|
Загрузка…
Ссылка в новой задаче