A custom React Typescript starter using Webpack 5.
Step 1: Install degit if you haven't already.
npm install -g degitStep 2 : Run the command with your app name.
npx degit https://github.com/OmKakatkar/react-ts-webpack my-appStep 3: Run the setup command
cd my-app && yarn setup- The setup command does the following :
- Install Dependencies
- Creates a git repository
- Run
husk install - Commit the changes to git
yarn startyarn build- Make sure you have installed EsLint plugin for VSCode.
- Then run the following command for manual linting.
yarn lint- Install the Prettier plugin for VSCode.
- Then run the following command for manual formatting.
yarn format- Go to Manage > Settings > User.
- Enable the
Format On Saveoption. - Now your code will the auto linted and formatted on save.
- The starter uses
huskyfor a pre-commit hook. - It is useful while developing as a team to ensure the code to be commited is properly linted and formatted.
- This does not require any any additional setup.
- It would auto format the code before commit without errors.
- It would try to fix linting error before aborting the commit if it could not fix the linting issues.
- Provides a starter folder for React TypeScript Web Application
- Babel and Webpack 5
- HTML Parser
- CSS Loader
- Image Loader
- Inline SVG Loader
- Dev Server with Webpack
- Separate Dev and Prod Configs for Webpack
- React Refresh for Hot Reload
- ESLint
- Prettier
- Pre Commit Linting + Formatting with Husky
- Babel Runtime
- Asset Copy Plugin
- Code Splitting (Vendor + Main + Runtime)
- Caching
- Lazy Loading
- Support for dotenv files
- Use
.env.developmentfor dev environment - Use
.env.productionfor prod environment - Modify babel config in babelrc
- All linting rules
- All formatting rules
- TypeScript Config
- Webpack Config includes dev, prod configs along with a common config. More plugins can be added here.