This repo demonstrates how to use rspack and Nx in a standalone React project.
pnpm installnpx nx serve demonpx nx build demoNOTE: Nx caches the build output (i.e.
dist) if the source files have not changed. When a test file (e.g.*.spec.tsx) changes, the build is still cached.
npx serve dist/apps/demoThis project uses Jest to run unit tests.
npx nx test demoNOTE: Nx caches the test result if the source and test files have no changed. When a non-source, non-test file (e.g.
*.md) changes, the test is still cached.
You can also test the ui library (which is not included in app tests).
npx nx test uiNOTE: Changes to
uispec files do not affect the app's test cache. So updating sayheader.spec.tsxwill not invalidate cache fornpx nx test.
To run all tests, use this command.
npx nx run-many -t test