From aca9119c9797d558d54f96cfafe738c016ac1824 Mon Sep 17 00:00:00 2001 From: "Jon Thysell (JAUNTY)" Date: Thu, 30 Mar 2023 12:43:20 -0700 Subject: [PATCH 1/3] Workaround fix for "missing-asset-registry-path" error to unblock PRs New app projects built against main are unable to create their bundle (see #11437). As such, all PRs are blocked as the New CLI app checks all fail. The problem is that the metro config needs `transformer.assetRegistryPath` to be set to the location of `./Libraries/Image/AssetRegistry`, which for our purposes is the copy located in the RNW folder. For some reason this isn't set anymore. This PR adds a workaround of specifying that path in our app template's metro.config.js file. This unblocks our PRs but we should probably find a better place than in an app template file. Resolves #11437 --- vnext/template/metro.config.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vnext/template/metro.config.js b/vnext/template/metro.config.js index abc20133aba..e49f1cded14 100644 --- a/vnext/template/metro.config.js +++ b/vnext/template/metro.config.js @@ -26,6 +26,11 @@ module.exports = { ]), }, transformer: { + // This fixes the 'missing-asset-registry-path` error (see https://github.com/microsoft/react-native-windows/issues/11437) + assetRegistryPath: require.resolve( + rnwPath, + './Libraries/Image/AssetRegistry', + ), getTransformOptions: async () => ({ transform: { experimentalImportSupport: false, From e46efa13d68d1a8d611bffc1d2056f68161c7138 Mon Sep 17 00:00:00 2001 From: "Jon Thysell (JAUNTY)" Date: Thu, 30 Mar 2023 12:49:03 -0700 Subject: [PATCH 2/3] Change files --- ...ative-windows-a5110142-aafe-4bbf-ac8b-1a6c6cdd9405.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/react-native-windows-a5110142-aafe-4bbf-ac8b-1a6c6cdd9405.json diff --git a/change/react-native-windows-a5110142-aafe-4bbf-ac8b-1a6c6cdd9405.json b/change/react-native-windows-a5110142-aafe-4bbf-ac8b-1a6c6cdd9405.json new file mode 100644 index 00000000000..bcf8eab5ad6 --- /dev/null +++ b/change/react-native-windows-a5110142-aafe-4bbf-ac8b-1a6c6cdd9405.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Workaround fix for \"missing-asset-registry-path\" error to unblock PRs", + "packageName": "react-native-windows", + "email": "jthysell@microsoft.com", + "dependentChangeType": "patch" +} From 0afef55f2f8eeb305c80a15ad22340b7c56c5502 Mon Sep 17 00:00:00 2001 From: "Jon Thysell (JAUNTY)" Date: Thu, 30 Mar 2023 13:09:32 -0700 Subject: [PATCH 3/3] better workaround fix --- vnext/template/metro.config.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/vnext/template/metro.config.js b/vnext/template/metro.config.js index e49f1cded14..7cab9f209e6 100644 --- a/vnext/template/metro.config.js +++ b/vnext/template/metro.config.js @@ -26,16 +26,13 @@ module.exports = { ]), }, transformer: { - // This fixes the 'missing-asset-registry-path` error (see https://github.com/microsoft/react-native-windows/issues/11437) - assetRegistryPath: require.resolve( - rnwPath, - './Libraries/Image/AssetRegistry', - ), getTransformOptions: async () => ({ transform: { experimentalImportSupport: false, inlineRequires: true, }, }), + // This fixes the 'missing-asset-registry-path` error (see https://github.com/microsoft/react-native-windows/issues/11437) + assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry', }, };