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.git
cd 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.js
file.
- By default, the toolkit splits and extracts third party
npm
libraries intovendor
chunks as these are less likely to change than the source code of your app. This is done using thecacheGroups
option of theSplitChunksPlugin
inwebpack.config.common.js
- Run
npm start
to 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
./dist
folder but they will not be minified.
- Run
npm run build
to build all the project assets in thedist
folder. - This generates the build files within
./dist
folder and they will be minified.