๐ Webpack 5 template with React 18 using Babel 7, HMR, Sass and PostCSS with a hot dev server and an optimized production build.
Clone this repository and npm install:
git clone https://github.com/B4rt0sz/react-webpack-5-template.git
cd react-webpack-5-template
npm install
Alternative:
Use the green Template Button on top right of this repository.
add .env.development and .env.production to your .gitignore!
npm start
You can view the development server at localhost:8080
(You can change port in ./config/webpack.dev.js).
npm run build
react
- React is a JavaScript library for creating user interfaces. For creating React componentsreact-dom
- This package serves as the entry point to the DOM and server renderers for Reactreact-router-dom
- This package serves as DOM for React Router
@babel-runtime
- Contains Babel modular runtime helpers
webpack
- Module and asset bundlerwebpack-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/preset-env
- Smart defaults for Babel@babel/preset-react
- Babel preset for all React plugins@babel/plugin-transform-runtime
- Enables the re-use of Babel's injected helper code to save on codesize
babel-loader
- Transpile files with Babel and webpackcss-loader
- Resolve CSS importsnode-sass
- Node Sasspostcss-loader
- Loader to process CSS with PostCSSpostcss-preset-env
- Sensible defaults for PostCSSsass-loader
- Load SCSS and compile to CSSstyle-loader
- Inject CSS into the DOM
html-webpack-plugin
- Generate HTML files from templatemini-css-extract-plugin
- Extract CSS into separate filescss-minimizer-webpack-plugin
- Optimize and minimize CSS assetsreact-refresh
- HMR using React Fast Refresh@pmmmwh/react-refresh-webpack-plugin
- Dependency forreact-refresh-webpack-plugin
plugincopy-webpack-plugin
- Copies individual files or entire directories, which already exist, to the build directorydotenv-webpack
- Supports dotenv and other environment variablesimage-minimizer-webpack-plugin
- Plugin and Loader to optimize (webp 90%) all images usingsharp
eslint
- Enforce styleguide across application@babel/eslint-parser
- Lint ALL valid Babel code with the ESLinteslint-config-prettier
- Implment prettier ruleseslint-plugin-import
- Implment import ruleseslint-import-resolver-alias
- Simple Node.js module import resolution plugin foreslint-plugin-import
@babel/eslint-plugin
- Companion rules for@babel/eslint-parser
eslint-plugin-prettier
- Runs Prettier as an ESLint ruleeslint-plugin-react
- React specific linting rules for ESLinteslint-plugin-react-hooks
- ESLint plugin enforces the Rules of Hooksprettier
- Prettier is an opinionated code formatter
Bartosz Szuฤko
This project is open source and available under the MIT License.