webpackDllPlugin and DllReferencePlugin


Introduction

The Dll and DllReference plugins allow the code to be split in multiple bundles in a way the bundles can be compiled independently.

It is possible to build "vendor" scripts in a library that does not need to be compiled often (ex: React, jQuery, Bootstrap, Fontawesome...) and reference it in your app bundle that will need those scripts.

The application bundle, the one that is constantly going to be changed, will be in a separate configuration just referencing a already built "vendor" bundle.

Syntax

  • new webpack.DllPlugin({ path: '[name]-manifest.json', name: '[name]_[hash]' })
  • new webpack.DllReferencePlugin({ context: __dirname, manifest: require('./packname-manifest.json') })