A starter kit that you can use to create a project using ES6 full features (including module export/import) with React, Caching, Code Splitting & running ESlint checks.
The tool kit provides the following features:
- Compilation of ES6 into ES5
- loaders
- css asset
- inline asset
- webpack plugin
- Code Splitting
- Caching
- Webpack dev server
- Run ESlint checks
- Lazy Loading
- Bundle Analyzer
git clone https://github.com/Devansu-Yadav/Webpack-starter-kit.gitcd Webpack-starter-kit- Run
npm install
You can also use the following command to get this template - degit https://github.com/Devansu-Yadav/Webpack-starter-kit
The toolkit provides out of the box caching functionalities which are implemented in the following two ways:
- Using
[contenthash]to cache bundle files - Extracting & caching non-changing third party libraries into vendor bundles
- Webpack provides a way to use filename substitutions to insert hashes of the file content using
[contenthash]in the filename to cache files that don't change after a build of your app. This is leveraged in the toolkit to cache bundles by default and this behavior can be changed by updating thewebpack.config.common.jsfile.
- By default, the toolkit splits and extracts third party
npmlibraries intovendorchunks as these are less likely to change than the source code of your app. This is done using thecacheGroupsoption of theSplitChunksPlugininwebpack.config.common.js
- Run
npm startto start Webpack dev server. - To build and generate files in the development mode, run the following command after local setup:
npm run build-dev. - This generates the build files within
./distfolder but they will not be minified.
- Run
npm run buildto build all the project assets in thedistfolder. - This generates the build files within
./distfolder and they will be minified.