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

Available tasks for a project missing after vite.config.ts #22244

Closed
1 of 4 tasks
ubugnu opened this issue Mar 8, 2024 · 5 comments · Fixed by #22618
Closed
1 of 4 tasks

Available tasks for a project missing after vite.config.ts #22244

ubugnu opened this issue Mar 8, 2024 · 5 comments · Fixed by #22618
Assignees
Labels
outdated scope: bundlers Issues related to webpack, rollup type: bug

Comments

@ubugnu
Copy link
Contributor

ubugnu commented Mar 8, 2024

Current Behavior

Available tasks for a fresh react app installed in a monorepo are only lint after editing ./apps/react-monorepo/vite.config.ts

Expected Behavior

They should be: build, serve, preview, serve-static, test and lint

GitHub Repo

No response

Steps to Reproduce

  1. npx create-nx-workspace@latest react-monorepo --preset=react-monorepo
  2. choose the following
✔ Application name · react-monorepo
✔ Which bundler would you like to use? · vite
✔ Test runner to use for end to end (E2E) tests · cypress
✔ Default stylesheet format · css
✔ Do you want Nx Cloud to make your CI fast? · github
  1. nx show project react-monorepo give the following:
{"root":"apps/react-monorepo","targets":{"build":{"options":{"cwd":"apps/react-monorepo","command":"vite build"},"cache":true,"dependsOn":["^build"],"inputs":["production","^production",{"externalDependencies":["vite"]}],"outputs":["{workspaceRoot}/dist/apps/react-monorepo"],"executor":"nx:run-commands","configurations":{}},"serve":{"options":{"cwd":"apps/react-monorepo","command":"vite serve"},"executor":"nx:run-commands","configurations":{}},"preview":{"options":{"cwd":"apps/react-monorepo","command":"vite preview"},"executor":"nx:run-commands","configurations":{}},"serve-static":{"executor":"@nx/web:file-server","options":{"buildTarget":"build"},"configurations":{}},"test":{"options":{"cwd":"apps/react-monorepo","command":"vitest run"},"cache":true,"inputs":["default","^production",{"externalDependencies":["vitest"]}],"outputs":["{workspaceRoot}/coverage/apps/react-monorepo"],"executor":"nx:run-commands","configurations":{}},"lint":{"cache":true,"options":{"cwd":"apps/react-monorepo","command":"eslint ."},"inputs":["default","{workspaceRoot}/.eslintrc.json","{workspaceRoot}/apps/react-monorepo/.eslintrc.json","{workspaceRoot}/tools/eslint-rules/**/*",{"externalDependencies":["eslint"]}],"executor":"nx:run-commands","configurations":{}}},"name":"react-monorepo","$schema":"../../node_modules/nx/schemas/project-schema.json","sourceRoot":"apps/react-monorepo/src","projectType":"application","tags":[],"implicitDependencies":[]}
  1. edit ./apps/react-monorepo/vite.config.ts
-   outDir: '../../dist/apps/react-monorepo',
+   outDir: './build/react-store',
  1. save
  2. nx show project react-monorepo gives:
{"root":"apps/react-monorepo","targets":{"lint":{"cache":true,"options":{"cwd":"apps/react-monorepo","command":"eslint ."},"inputs":["default","{workspaceRoot}/.eslintrc.json","{workspaceRoot}/apps/react-monorepo/.eslintrc.json","{workspaceRoot}/tools/eslint-rules/**/*",{"externalDependencies":["eslint"]}],"executor":"nx:run-commands","configurations":{}}},"name":"react-monorepo","$schema":"../../node_modules/nx/schemas/project-schema.json","sourceRoot":"apps/react-monorepo/src","projectType":"application","tags":[],"implicitDependencies":[]}

Nx Report

Node   : 18.13.0
OS     : linux-x64
npm    : 9.2.0

nx (global)        : 18.0.7
nx                 : 18.0.7
@nx/js             : 18.0.7
@nx/linter         : 18.0.7
@nx/eslint         : 18.0.7
@nx/workspace      : 18.0.7
@nx/cypress        : 18.0.7
@nx/devkit         : 18.0.7
@nx/eslint-plugin  : 18.0.7
@nx/react          : 18.0.7
@nrwl/tao          : 18.0.7
@nx/vite           : 18.0.7
@nx/web            : 18.0.7
typescript         : 5.3.3

Failure Logs

No response

Package Manager Version

No response

Operating System

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

Additional Information

However, if we delete nx cache: rm -r .nx/cache, the correct target list is seen.

@MaximeBernard
Copy link

Hi @ubugnu I'm having a similar issue with vite-plugin.

My issue is flakking the CI. we added a
"prebuild": "nx show project my-project"
Sometimes, build is showing, sometimes, it doesn't. In my current CI run, I only have lint & test

We have 5 vite packages, each run fails on a different one.

It seems the issue comes from vite plugin but I have no idea how and why.

@MaximeBernard
Copy link

Seem heavily related to #22285

@MaximeBernard
Copy link

@JamesHenry Since you merged the PR, can you confirm the PR will fix our issue?

@MaximeBernard
Copy link

MaximeBernard commented Mar 13, 2024

Tried nx 18.1.0-beta.9 with no luck

Probably related to dependency issues though

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @nx/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/nx
npm WARN   dev nx@"^18.1.0-beta.9" from the root project
npm WARN   2 more (@nrwl/tao, @nx/workspace)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer nx@">= 16 <= 18" from @nx/[email protected]
npm WARN node_modules/@nx/devkit
npm WARN   @nx/devkit@"18.1.0-beta.9" from @nrwl/[email protected]
npm WARN   node_modules/@nrwl/devkit
npm WARN   9 more (@nx/eslint, @nx/js, @nx/next, @nx/playwright, @nx/react, ...)
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/nx
npm WARN   peer nx@">= 16 <= 18" from @nx/[email protected]
npm WARN   node_modules/@nx/devkit
npm WARN     @nx/devkit@"18.1.0-beta.9" from @nrwl/[email protected]
npm WARN     node_modules/@nrwl/devkit
npm WARN     9 more (@nx/eslint, @nx/js, @nx/next, @nx/playwright, @nx/react, ...)

Copy link

github-actions bot commented May 4, 2024

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: bundlers Issues related to webpack, rollup type: bug
Projects
None yet
4 participants