-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
metro web builds cache key collision #27392
Comments
this seems to be something to do with expo cache. the easist way to fix is just run the command with
|
the other thing you can do is in project.json, add targets:
so it will always clear the expo cache when you can export command. |
Thanks for taking a look at this!
Yes, this is in line with our findings here:
EDIT: updated to improve clarity I think it'd be useful to add something to the You can see an example of what Im talking about here, which leverages the |
this solves the metro cache key between 2 different apps. however, when I change the .env file or app.config.js, it does not refresh the output. |
Nice find! Just confirmed on my end too. Oddly passing
I'm guessing the expo app config is being compiled separately from other app files — because changes to (I tried looking at the expo/metro source code to see how that was working, but no luck, so far) I can imagine why they might want to cache it separately, but yeah would seem like an oversight that modifying the app config file wouldn't break its cache. 🤷 I think the "sticky app config cache" issues could probably be considered separately from the "cross-project cache contamination" issue. If its agreeable to y'all, I'd vote in favor of shipping the |
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> expo tends to cache the output if there is no change in metro.config.js we don't need to explicitly set the args --clear when expo/expo#30930 is fixed ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #27392
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> expo tends to cache the output if there is no change in metro.config.js we don't need to explicitly set the args --clear when expo/expo#30930 is fixed ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #27392 (cherry picked from commit 925672e)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> expo tends to cache the output if there is no change in metro.config.js we don't need to explicitly set the args --clear when expo/expo#30930 is fixed ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes nrwl#27392
Current Behavior
After upgrading to Expo SDK 51, and adpting expo web projects from webpack to metro web, we noticed that sometimes one project's build would have environment variables from a different project in the monorepo.
The issue was intermittent and only happened in pipelines with multiple web builds.
We determined that — if the
metro.config.js
file is identical between two or more projects — then it uses the same cache key. And when multiple projects are being built — after the first project is completed — subsequent projects will resolve the first project's compiled/cached app config (etc) from metro cache — because they have the same cache-key.Note
This is also true for
start
commands, and (presumably) other build related commands.EDIT: updated to improve clarity
Expected Behavior
The builds should be isolated and config from one build should not leak into subsequent builds.
GitHub Repo
https://github.com/leggomuhgreggo/metro-web-cache-issue-2024-08-09
Steps to Reproduce
Follow instructions in README.
Nx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
I've also opened up an issue on the expo repo here:
expo/expo#30930
The text was updated successfully, but these errors were encountered: