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

serve-static target should not be created without e2e config #27854

Closed
1 of 4 tasks
DariusPa opened this issue Sep 10, 2024 · 1 comment · Fixed by #27924
Closed
1 of 4 tasks

serve-static target should not be created without e2e config #27854

DariusPa opened this issue Sep 10, 2024 · 1 comment · Fixed by #27924
Assignees
Labels
scope: angular Issues related to Angular support in Nx type: bug

Comments

@DariusPa
Copy link

DariusPa commented Sep 10, 2024

Current Behavior

  1. Generate new application without e2e config: nx g @nx/angular:application app123 --directory apps --bundler=esbuild --ssr=false --projectNameAndRootFormat=derived
  2. Generated app GENERATES serve-static target under project.json even though I haven't passed e2eTestRunner flag

Expected Behavior

  1. Generate new application without e2e config: nx g @nx/angular:application app123 --directory apps --bundler=esbuild --ssr=false --projectNameAndRootFormat=derived
  2. Newly created app SHOULD NOT generate serve-static target under project.json if e2eTestRunner flag is not passed

GitHub Repo

No response

Steps to Reproduce

  1. nx g @nx/angular:application app123 --directory apps --bundler=esbuild --ssr=false --projectNameAndRootFormat=derived

Nx Report

Node           : 18.17.0
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.1.0

nx (global)        : 17.0.3
nx                 : 19.6.4
@nx/js             : 19.6.4
@nx/jest           : 19.6.4
@nx/linter         : 19.6.4
@nx/eslint         : 19.6.4
@nx/workspace      : 19.6.4
@nx/angular        : 19.6.4
@nx/cypress        : 19.6.4
@nx/devkit         : 19.6.4
@nx/eslint-plugin  : 19.6.4
@nx/nest           : 19.6.4
@nx/node           : 19.6.4
@nx/playwright     : 19.6.4
@nx/plugin         : 19.6.4
@nrwl/tao          : 19.6.4
@nx/vite           : 19.6.4
@nx/web            : 19.6.4
@nx/webpack        : 19.6.4
typescript         : 5.5.4
---------------------------------------
Community plugins:
@ngneat/transloco        : 6.0.4
@ngrx/component-store    : 18.0.2
@ngrx/effects            : 18.0.2
@ngrx/entity             : 18.0.2
@ngrx/eslint-plugin      : 18.0.2
@ngrx/operators          : 18.0.2
@ngrx/router-store       : 18.0.2
@ngrx/schematics         : 18.0.2
@ngrx/signals            : 18.0.2
@ngrx/store              : 18.0.2
@ngrx/store-devtools     : 18.0.2
angular-auth-oidc-client : 18.0.1
apollo-angular           : 7.1.2

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

The code that needs to be moved:

addFileServerTarget(tree, options, 'serve-static', e2eWebServerInfo.e2ePort);

Pull request opened: #27853

@Coly010
Copy link
Contributor

Coly010 commented Sep 16, 2024

The serve static target is useful for other scenarios:

  • Previewing a production version of your application locally
  • Module Federation features

It is not constrained to just e2e.

I'll make a slight change to how and where it is set up to reflect this.

@Coly010 Coly010 self-assigned this Sep 16, 2024
@Coly010 Coly010 added the scope: angular Issues related to Angular support in Nx label Sep 16, 2024
Coly010 added a commit that referenced this issue Sep 16, 2024
<!-- 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 -->
The `serve-static` target is being added in the `add-e2e` file, however,
it has uses beyond e2e.



## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
The `serve-static` target should be added with more intention

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

Fixes #27854
FrozenPandaz pushed a commit that referenced this issue Sep 18, 2024
<!-- 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 -->
The `serve-static` target is being added in the `add-e2e` file, however,
it has uses beyond e2e.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
The `serve-static` target should be added with more intention

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

Fixes #27854

(cherry picked from commit d723326)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: angular Issues related to Angular support in Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants