Optimized Nx Monorepo Configuration for React & Vite Projects#384
Closed
AditiChauhan19 wants to merge 1 commit into
Closed
Optimized Nx Monorepo Configuration for React & Vite Projects#384AditiChauhan19 wants to merge 1 commit into
AditiChauhan19 wants to merge 1 commit into
Conversation
✅ Key Changes Added "serve" to cacheableOperations. Added "sharedGlobals" with tsconfig.base.json and .env. Separated development input (ready if you want faster dev builds). Added shared ESLint config in lint inputs. Added vitest.config.ts to test inputs. Apps and libs folder separated (apps vs packages). Enabled routing: true in React generator for new apps.
Collaborator
|
What problem does this PR solve? It seems AI generated so I'll close it. I'm happy to reopen if it improves something relevant. |
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.
✅ Key Changes
Added "serve" to cacheableOperations.
Added "sharedGlobals" with tsconfig.base.json and .env.
Separated development input (ready if you want faster dev builds).
Added shared ESLint config in lint inputs.
Added vitest.config.ts to test inputs.
Apps and libs folder separated (apps vs packages).
Enabled routing: true in React generator for new apps.
##What?
This PR updates and optimizes the Nx monorepo configuration (nx.json) for React and Vite projects. Key improvements include:
-Enhanced caching for build, lint, test, e2e, and serve operations.
-Added shared global inputs (tsconfig.base.json, .env) for proper cache invalidation.
-Separate development and production inputs for faster local builds.
-Updated lint and test targets to include shared configs and Vitest.
-React generator now supports routing by default.
##Why?
This PR is necessary to improve developer productivity and maintainability of the monorepo. It solves the following issues:
-Inefficient caching in Nx tasks.
-Missing shared configurations causing unnecessary rebuilds.
-Lack of default routing setup in React apps.
-Limited test runner inputs, causing stale or inconsistent test results.
##How?
-Updated tasksRunnerOptions with serve added to cacheableOperations.
-Added sharedGlobals to track changes in global config files.
-Defined separate development and production inputs for build targets.
-Included shared ESLint and Vitest configs in lint and test targets.
-Updated workspaceLayout to separate apps (apps) and libs (packages).
-Enabled routing in React app generator.
-Testing Instructions
Check out the branch:
git fetch origin
git checkout
Run build, lint, and test commands:
nx build
nx lint
nx test
nx e2e
nx serve
Verify that caching works as expected and new apps are generated with routing enabled:
nx generate @nx/react:application test-app
Confirm that changes to .env or tsconfig.base.json invalidate caches correctly for all projects.