React 17 Boilerplate with React 17, Webpack 6, Tailwind 2, HMR, using babel, Jest unit testing, sass, with a hot dev server and an optimized production build
Maintained by Altafino - Full-Stack Go/JS Development
- added full support for unit testing (with file mocks) using Jest
- added SVGR as a webpack loader to import your SVG directly as a React Component.
- added build-staging script. same as build but using .env.staging
- added dotenv-webpack to handle process.env.VARS
- added Prettier
- added react-refresh-webpack-plugin for HMR
git clone https://github.com/altafino/react-webpack-5-tailwind-2.git
cd react-webpack-5-tailwind-2
yarn / npm i
To use it for your own project the easiest way is to use the green Template Button on top right of this repo on Github.
yarn start / npm start
You can view the development server at localhost:3000
.
(change port in ./config/webpack.dev.js)
yarn test / npm test
yarn build / npm run build
webpack
- Module and asset bundler.webpack-cli
- Command line interface for webpackwebpack-dev-server
- Development server for webpackwebpack-merge
- Simplify development/production configuration
@babel/core
- Transpile ES6+ to backwards compatible JavaScript@babel/plugin-proposal-class-properties
- Use properties directly on a class (an example Babel config)@babel/preset-env
- Smart defaults for Babel
jest
- Delightful JavaScript Testing@testing-library/jest-dom
- Custom jest matchers to test the state of the DOM@testing-library/react
- Simple and complete React DOM testing utilities@testing-library/user-event
- Fire events the same way the user does
babel-loader
- Transpile files with Babel and webpacksass-loader
- Load SCSS and compile to CSSnode-sass
- Node Sasscss-loader
- Resolve CSS importspostcss-loader
- Loader to process CSS with PostCSSstyle-loader
- Inject CSS into the DOM
eslint-config-prettier
- Turns off all rules that are unnecessary or might conflict with Prettier.eslint-import-resolver-alias
- a simple Node behavior import resolution plugin for eslint-plugin-import, supporting module alias.eslint-plugin-babel
- an eslint rule plugin companion to babel-eslint.eslint-plugin-import
- This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import names.eslint-plugin-prettier
- Runs prettier as an eslint rule.eslint-plugin-react
- React specific linting rules for ESLint.eslint-plugin-react-hooks
- Enforces the Rules of React Hooks.
clean-webpack-plugin
- Remove/clean build folderscopy-webpack-plugin
- Copy files to build directoryhtml-webpack-plugin
- Generate HTML files from templatemini-css-extract-plugin
- Extract CSS into separate filesoptimize-css-assets-webpack-plugin
- Optimize and minimize CSS assetsterser-webpack-plugin
- Optimize and minimize JavaScriptreact-refresh-webpack-plugin
- HMR using React Fast Refreshdotenv-webpack
- Supports dotenv and other environment variables@svgr/webpack
- SVGR can be used as a webpack loader, this way you can import your SVG directly as a React Component.babel-jest
- Babel jest plugin for transforimg.js
and.jsx
files