Skip to content

Commit 14a9808

Browse files
fix: adjust binary call for microfrontends proxy on Windows (#10962)
### Description The microfrontends local development proxy fails to start on Windows because it runs into: `%1 is not a valid Win32 application`. The issue is that Turborepo runs the `.js` script and relies on the shebang to be run correctly. That doesn't work on Windows. This PR changes the code to run `node` which will work on Windows. ### Testing Instructions In a microfrontends repository, such as https://github.com/vercel-labs/microfrontends-nextjs-app-multi-zone, run `pnpm turbo run dev` on Windows and ensure that it starts up. --------- Co-authored-by: Anthony Shew <[email protected]>
1 parent 68d70f1 commit 14a9808

File tree

1 file changed

+9
-1
lines changed
  • crates/turborepo-lib/src/task_graph/visitor

1 file changed

+9
-1
lines changed

crates/turborepo-lib/src/task_graph/visitor/command.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,16 @@ impl<'a, T: PackageInfoProvider> CommandProvider for MicroFrontendProxyProvider<
256256
let mut args = vec!["proxy", mfe_path.as_str(), "--names"];
257257
args.extend(local_apps);
258258

259+
// On Windows, a package manager will rework the binary to be a .cmd extension
260+
// since that's what Windows needs
261+
let bin_name = if cfg!(windows) {
262+
"microfrontends.cmd"
263+
} else {
264+
"microfrontends"
265+
};
266+
259267
// TODO: leverage package manager to find the local proxy
260-
let program = package_dir.join_components(&["node_modules", ".bin", "microfrontends"]);
268+
let program = package_dir.join_components(&["node_modules", ".bin", bin_name]);
261269
let mut cmd = Command::new(program.as_std_path());
262270
cmd.current_dir(package_dir).args(args).open_stdin();
263271
cmd

0 commit comments

Comments
 (0)