Webpack ~ Features - rohit120582sharma/Documentation GitHub Wiki

Hot Module Replacement

HMR allows all kinds of modules to be updated at runtime without the need for a full refresh. HMR is not intended for use in production, meaning it should only be used in development.

// webpack.config.js
module.exports = {
	devServer: {
		hot: true
	},
	plugins: [
		new webpack.HotModuleReplacementPlugin()
	]
}

Tree Shaking

The new webpack 4 release expands on this capability with a way to provide hints to the compiler via the "sideEffects" in package.json flag to denote which files in your project are "pure" and therefore safe to prune if unused. So we can simply mark the property as false to inform webpack that it can safely prune unused exports.

// package.json
{
	"sideEffects": false
}

⚠️ **GitHub.com Fallback** ⚠️