What’s New in webpack 4 ― Scotch
- webpack 4 ships with a property called mode which allows you to easily set which environment you’re working on, development and production.
- It’s set to on by default in production mode – – In a bid to improve performance and get the best optimizes, UglifyJs now caches and parallizes by default in webpack 4.
With that being said, let’s explore some of the new features and improvements in webpack 4.
Using webpack 4 now guarantees you up to a 98% decrease in build time for your projects thanks to performance improvements. I tried it out myself on an existing webpack project that used webpack 3 and result saw a 2x decrease in build time. This is also something you can check out.
To get started with webpack 4, install in your project using yarn or npm.
npm i webpack webpack-cli –save-dev
yarn add webpack webpack-cli –dev
That’s all you need to start using the latest version. You can see screenshots of the build time for both webpack 3 4 projects.
webpack 3 – 1530ms