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

[fix] resolve paths in monorepo projects #685

Merged
merged 1 commit into from
Nov 9, 2021

Conversation

aurimasmi
Copy link
Collaborator

@aurimasmi aurimasmi commented Jun 8, 2021

Description

It's an override of same fix done on react-native and react-native-community/cli.

Original summary of fix:

When an asset is outside of the metro project root, it can lead to relative paths like /assets/../../node_modules/coolpackage/image.png as the httpServerLocation. This can happen for example when using yarn workspaces with hoisted node_modules.

This causes issues when bundling on iOS since we use this path in the filesystem. To avoid this we replace ../ with _ to preserve the uniqueness of the path while avoiding these kind of problematic relative paths. The same logic is used when bundling assets in the rn-cli.

It's easily visible/testable on monorepo projects which uses react-navigation. Header back icon is not visible without this fix.

I have tested my changes on:

ReNative project directly:

  • ios simulator
  • ios device
  • android simulator
  • android device
  • web browser
  • web -e next browser
  • tvos simulator
  • tvos device
  • androidtv simulator
  • androidtv device
  • androidwear simulator
  • androidwear device
  • tizen simulator
  • tizen device
  • tizenmobile simulator
  • tizenwatch device
  • webos simulator
  • webos device
  • macos
  • windows
  • chromecast device

Existing Project created with previous version of renative:

  • ios simulator
  • ios device
  • android simulator
  • android device
  • web browser
  • web -e next browser
  • tvos simulator
  • tvos device
  • androidtv simulator
  • androidtv device
  • androidwear simulator
  • androidwear device
  • tizen simulator
  • tizen device
  • tizenmobile simulator
  • tizenwatch device
  • webos simulator
  • webos device
  • macos
  • windows
  • chromecast device

@aurimasmi aurimasmi requested a review from pavjacko June 8, 2021 16:29
@pavjacko pavjacko merged commit d295030 into develop Nov 9, 2021
@pavjacko pavjacko deleted the fix/resolve-monorepo-assets-paths branch February 15, 2022 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants