Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround fix for "missing-asset-registry-path" error to unblock PRs #11438

Merged
merged 3 commits into from
Mar 30, 2023

Conversation

jonthysell
Copy link
Contributor

@jonthysell jonthysell commented Mar 30, 2023

Description

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 'react-native/Libraries/Image/AssetRegistry', as for some reason this isn't set anymore upstream.

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.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Why

Unblock our PRs.

Resolves #11437

What

Updates the new app template's metro.config.js file with the correct path which is no longer getting set for us.

Screenshots

N/A

Testing

Tested with a new CLI app.

Microsoft Reviewers: Open in CodeFlow
Microsoft Reviewers: Open in CodeFlow

New app projects built against main are unable to create their bundle (see microsoft#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 microsoft#11437
@jonthysell jonthysell added AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity) Area: CLI Breaking Change This PR will break existing apps and should be part of the known breaking changes for the release Area: Metro labels Mar 30, 2023
@jonthysell jonthysell requested review from a team as code owners March 30, 2023 19:53
@acoates-ms
Copy link
Contributor

This change will break all other platforms. -- it might be needed as a temp unblock tho

@jonthysell
Copy link
Contributor Author

jonthysell commented Mar 30, 2023

This change will break all other platforms. -- it might be needed as a temp unblock tho

Right, I don't know of better place to put it unless we want to wait for an upstream fix. Do we still have no way of making a change to metro.config.js that is one platform only?

@acoates-ms
Copy link
Contributor

For now we can at least set it to:
assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry',

That will work for all platforms, since we redirect any react-native import to react-native-windows when building windows packages.

@jonthysell
Copy link
Contributor Author

@acoates-ms The string you suggested appears to work. Care to sign-off?

Copy link
Contributor

@chiaramooney chiaramooney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jonthysell jonthysell merged commit 19c140b into microsoft:main Mar 30, 2023
@jonthysell jonthysell deleted the unblockprs branch March 30, 2023 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: CLI Area: Metro AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity) Breaking Change This PR will break existing apps and should be part of the known breaking changes for the release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bundling fails for new apps built against main with missing-asset-registry-path error
4 participants