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(mfe): build internal package if present in graph #9383

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

chris-olszewski
Copy link
Member

Description

Previously we were relying on the proxy already being built, for non-internal use cases this will be true, but for the internal case we need to make sure it is built before we try to start the proxy.

Testing Instructions

  • Edit packages/micro-frontends/dist/bin/cli.cjs and add a throw new Error("oops") to the top
  • turbo vercel-docs#dev should fail due to the proxy script failing
  • Now try with the PR turbo: turbo_dev --skip-infer vercel-docs#dev, you will see the MFE package being built before the proxy is started.

Copy link

vercel bot commented Nov 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 5, 2024 1:16am
8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Nov 5, 2024 1:16am
examples-designsystem-docs ⬜️ Ignored (Inspect) Nov 5, 2024 1:16am
examples-gatsby-web ⬜️ Ignored (Inspect) Nov 5, 2024 1:16am
examples-kitchensink-blog ⬜️ Ignored (Inspect) Nov 5, 2024 1:16am
examples-native-web ⬜️ Ignored (Inspect) Nov 5, 2024 1:16am
examples-svelte-web ⬜️ Ignored (Inspect) Nov 5, 2024 1:16am
examples-tailwind-web ⬜️ Ignored (Inspect) Nov 5, 2024 1:16am
examples-vite-web ⬜️ Ignored (Inspect) Nov 5, 2024 1:16am

@@ -57,6 +57,11 @@ impl From<UnescapedString> for String {
}
}

impl From<String> for UnescapedString {
Copy link
Member Author

Choose a reason for hiding this comment

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

Required since there isn't any other way to construct an UnescapedString

@@ -184,7 +186,10 @@ impl TurboJsonLoader {
Error::NoTurboJSON => Ok(TurboJson::default()),
err => Err(err),
})?;
turbo_json.with_proxy();
let needs_proxy_build = packages
Copy link
Member Author

Choose a reason for hiding this comment

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

We only want to add this if the internal package is in the graph meaning there's a valid build task

@chris-olszewski chris-olszewski marked this pull request as ready for review November 5, 2024 01:18
@chris-olszewski chris-olszewski requested a review from a team as a code owner November 5, 2024 01:18
@@ -619,6 +620,11 @@ impl TurboJson {
TaskName::from("proxy"),
Spanned::new(RawTaskDefinition {
cache: Some(Spanned::new(false)),
depends_on: needs_proxy_build.then(|| {
Spanned::new(vec![Spanned::new(UnescapedString::from(format!(
"{MICRO_FRONTENDS_PACKAGE_INTERNAL}#build"
Copy link
Member

Choose a reason for hiding this comment

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

Don't love that we have to hardcode this task, but we can iterate on it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I also don't love this, but for all other uses of the MFE package that don't have it as a workspace package this will be unnecessary.

@chris-olszewski chris-olszewski merged commit d02463f into main Nov 5, 2024
40 checks passed
@chris-olszewski chris-olszewski deleted the olszewski/fix_mfe_proxy_build branch November 5, 2024 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants