rspack example
This repo demonstrates how to use rspack and Nx in a standalone React project.
Setup
pnpm install
Running development server
pnpm run dev
# Or
npx nx dev
Building production bundle
pnpm run build
# Or
npx nx build
NOTE: 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.
Running production bundle
npx serve dist/demo
Running tests
This project uses Jest to run unit tests.
pnpm run test
# Or
npx nx test
NOTE: 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 ui
NOTE: Changes to
ui
spec files do not affect the app's test cache. So updating sayheader.spec.tsx
will not invalidate cache fornpx nx test
.
To run all tests, use this command.
npx nx run-many -t test