This is a basic yet opinionated react typescript starter using webpack as bundler, babel as transpiler and pnpm as package-manager.
- Check this out and update the project
name
andversion
at the top of the package.json file. - run
pnpm i
to install the dependencies - run dev server via
pnpm dev
- recent version of Node.js (>= 18)
- recent version of pnpm (>= 8)
We use pnpm
so if you don't have it install it via corepack like so:
corepack enable
corepack prepare pnpm@latest --activate
# verify that everything worked
pnpm --version # this should print out the version of the newly installed pnpm
You can start webpack's dev-server via pnpm dev
.
Create a production bundle via pnpm build
. This will be placed under dist
. You could then for example run it (for testing purposes) using a http server of your choice, e.g:
python -m http.server -d dist 8081
or
pnpm dlx http-server ./dist -p 8082 --proxy http://localhost:8082?
There are a set of tools/mechanism that help you enforce formatting and coding standards:
- formatter (uses prettier):
pnpm format
- linter: (uses eslint with typescript enabled)
pnpm lint
- typechecks: (uses tsc without emitting any code):
pnpm typecheck
- git hooks (via husky): These are maintained in the
.husky
subfolder and will be installed when you runpnpm i
orpnpm prepare
. They are executed each time you commit changes and will run the above tools. - GitHub workflows (located in
.github/workflows
): these run in the CI/CD pipeline of Git and run the above tools and also ensures a few guidelines regarding Git, for instance ensuring that the Git history remains linear: https://www.bitsnbites.eu/a-tidy-linear-git-history/.