Repository navigation
fix: run tunnel targets with their own Nx task variables - #230
Merged
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
The tunnel executor starts the Custom UI serve targets and the Forge app's watch build from within the tunnel task. Commands that nx:run-commands starts for them inherited the tunnel task's NX_TASK_TARGET_* variables, so NxAppWebpackPlugin loaded the options of the tunnel target of the Forge app. Inferred webpack serve targets failed to start, and the watch build wrote the bundle to the artifact directory instead of the bundle folder. Set the variables to the target being run, and keep the env option the target already has. Also build absolute file paths with path.join in the deploy, package and tunnel executors and the application generator. joinPathFragments drops the Windows drive letter, so these paths pointed at the current drive. And remove two code paths of the manifest patching that cannot run, because every resource gets a resource type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tbinna
force-pushed
the
fix/tunnel-task-env
branch
from
November 26, 2026 09:01
634ec7e to
7f3a728
Compare
Contributor
|
🎉 This PR is included in version 10.0.0-beta.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nx tunnelfailed for apps that use the inferred webpack targets from the getting-started guide. The tunnel executor starts the Custom UIservetargets and the Forge app's watch build inside its own process, so the commands thatnx:run-commandsstarts for them inherited the tunnel task'sNX_TASK_TARGET_*variables.NxAppWebpackPluginreads these to find its project and target, so it loaded the Forge app'stunneltarget options:ENOENT .../<forge-app>/src/favicon.ico).outputPathand wrote the bundle to<artifact>/index.jsinstead of<artifact>/functions/index.js, so the tunnel timed out waiting for it.Every target the tunnel starts now goes through
runTarget:envoverride replaces the target's ownenvoption, sorunTargetkeeps it. Inferred webpack targets setNODE_ENVthere.''rather thanundefined, because a command that Nx runs in a pseudo terminal keeps an inherited variable whose value isundefined.envis an option ofrun-commandsitself, so Nx does not forward it to the command line.Cleanup in the same commit:
joinPathFragments, which drops the Windows drive letter because it is meant for paths in config files. They now usepath.join:Evidence
Before, in nx-forge-examples (Nx 24.0.7) with the tunnel task's variables set:
runExecutorof the webpack app'sbuildwrotedist/apps/nx-forge-app-webpack/index.js, and thejira-global-pagebuild failed withENOENT .../nx-forge-app-webpack/src/favicon.ico.After: through
runTarget, the bundle lands infunctions/index.jsandjira-global-pagebuilds.run-target.spec.tsruns the realnx:run-commandsexecutor from a process with the tunnel's variables:It also checks that the target's
envand its default configuration'senvare kept.pnpm nx run-many -t lint test buildpasses (136 nx-forge tests, 8 docs-tools tests), and so does the format check. The newpatch-manifest-yml.spec.tsfrom feat!: always package UI Kit resources, and move resource paths when upgrading to v10 #229 covers the patching without the removed code paths.Not run: a full
nx tunnelin Jira with this build. An equivalent local patch was tested there for both example apps.Merge Danger
Door: one-way
Merging into
betapublishes the next10.0.0beta to npm under thebetadist-tag, and a published version cannot be reused.Blast Radius: tunnel, Windows paths
nx tunnelchanges only for targets that usenx:run-commands; other executors run as before. The path changes only matter on Windows, where the paths now keep their drive letter.🤖 Generated with Claude Code