A starter kit to quickly set up your JavaScript project with Webpack.
This is a configured Webpack build written in TypeScript for React + TypeScript development.
- Production Ready: Minified and optimized builds.
- Modern JavaScript: Write ESNext code with Babel.
- CSS and SCSS Support: Import and bundle your styles.
- Development Server: Live reloading with webpack-dev-server.
- Code Splitting: Improve load times with dynamic imports.
To get started, clone the repository and install the dependencies:
git clone https://github.com/Creator11/webpack-starter.git
cd webpack-starter
yarn installStart the server to dev mode
yarn startBuild development or production mode (defoult build run prod mode)
yarn build:dev yarn build:prodRun bundle analyze (defoult run production mode)
yarn analyzeRun typeScript type check
yarn typecheckRun ESLint or scssLint to lint your code.
yarn lint:ts
yarn lint:scssLint fix
yarn lint:ts:fix
yarn lint:scss:fix- All unused code is removed from the bundle (Tree shaking)
- Progress plugin added to dev build (helps analyze bundle build speed)
- All main filenames in the bundle are hashed for convenience
- No page reload on code changes in dev server
- Source maps are fully hashed in production bundle
- Depending on the build type (production or development), the type of router is chosen:
- in production createBrowserRouter
- in development createHashRouter - Relative paths @/... are set (all paths are defined in webpack.config.ts in BuildPaths)
- In dev mode, SCSS is not minified, allowing for better debugging
- Source maps allow debugging in the original source code
Main plugins:
1.ForkTsCheckerWebpackPlugin
2.ReactRefreshWebpackPlugin
3.WebpackBar
4.MiniCssExtractPlugin
5.BundleAnalyzerPlugin
Feel free to fork the repository and submit pull requests. Contributions are always welcome!
This project is licensed under the MIT License - see the LICENSE file for details.
