React Webpack with TypeScript development platform. Similar to CRA, but more lightweight and customizable. Includes react-refresh for a better development experience. Tested with Node 16+.
Currently set up for Bash. Use example: npm run dev
.
dev
- Run development serverbuild
- Build production version in/build
folderbuild:analyze
- Builds production version and runs build analyzer onhttp://localhost:8888
dev-build
- Creates a development build in/.dev
folderserve
- Serve production version
By default the server runs on 8888 and proxies /api
to http://localhost:8080/api
. Default config includes WebSocket support. See Webpack devserver.proxy
Supports both sass and css imports. Also includes normalize/sanitize.css
Has full support for css and scss modules. Use by importing like import style from './MyStyle.scss'
and then pass into jsx elements as <div className={style.myClass} />
. To use nested class names in scss use [class~='myClass'] { ... }
or :global(.myClass){ ... }
.
Files in public
folder will be served as /static/
in browser.
Supports absolute imports, e.g. import Test from 'components/Test'
. Configure in tsconfig.json
Supports SVG import as React Components like import MySvg from 'assets/mysvg.svg'
then use as <MySvg />
. Props are typed via main.d.ts.