Skip to content

fix(node): ensure artifacts are built before serving app #27146

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

Merged
merged 1 commit into from
Jul 26, 2024
Merged

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented Jul 26, 2024

This PR ensures that all dependencies are built before serving the Node app.

Current Behavior

If users don't manually run nx build <app> first, then the dependencies won't build because when @nx/js:node executor runs, it uses runExecutor which skips dependencies.

Expected Behavior

Set dependsOn on the serve target so run <app>:build first, which would ensure dependencies are all built. Also add runBuildTargetDependencies: false to the target options for visibility, so users could toggle it on if they want to re-build deps whenever there is a change (during watch). The option will slow things down, so we still want it to be false by default.

Related Issue(s)

Fixes #18964

@jaysoo jaysoo requested a review from a team as a code owner July 26, 2024 12:54
@jaysoo jaysoo requested a review from ndcunningham July 26, 2024 12:54
Copy link

vercel bot commented Jul 26, 2024

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

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Jul 26, 2024 1:18pm

@jaysoo jaysoo enabled auto-merge (squash) July 26, 2024 13:14

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
@jaysoo jaysoo merged commit b3d7509 into master Jul 26, 2024
6 checks passed
@jaysoo jaysoo deleted the issue/18964 branch July 26, 2024 13:24
FrozenPandaz pushed a commit that referenced this pull request Jul 30, 2024

Partially verified

This commit is signed with the committer’s verified signature.
FrozenPandaz’s contribution has been verified via GPG key.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
This PR ensures that all dependencies are built before serving the Node
app.
<!-- 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
If users don't manually run `nx build <app>` first, then the
dependencies won't build because when `@nx/js:node` executor runs, it
uses `runExecutor` which skips dependencies.

## Expected Behavior
Set `dependsOn` on the `serve` target so run `<app>:build` first, which
would ensure dependencies are all built. Also add
`runBuildTargetDependencies: false` to the target options for
visibility, so users could toggle it on if they want to re-build deps
whenever there is a change (during watch). The option will slow things
down, so we still want it to be `false` by default.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #18964

(cherry picked from commit b3d7509)
Copy link

github-actions bot commented Aug 1, 2024

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node library "Error: Cannot find module"
2 participants