The DllPlugin and DllReferencePlugin provide means to split bundles in a way that can drastically improve build time performance.


This plugin is used in a separate webpack config exclusively to create a dll-only-bundle. It creates a manifest.json file, which is used by the DllReferencePlugin to map dependencies.

new webpack.DllPlugin(options)

Creates a manifest.json which is written to the given path. It contains mappings from require and import requests, to module ids. It is used by the DllReferencePlugin.

Combine this plugin with output.library option to expose (aka, put into the global scope) the dll function.


This plugin is used in the primary webpack config, it references the dll-only-bundle(s) to require pre-built dependencies.

new webpack.DllReferencePlugin(options)

References a dll manifest file to map dependency names to module ids, then requires them as needed using the internal __webpack_require__ function.

Keep the name consistent with output.library.


This plugin can be used in two different modes, scoped and mapped.

Scoped Mode

The content of the dll is accessible under a module prefix. i.e. with scope = "xyz" a file abc in the dll can be access via require("xyz/abc").

Mapped Mode

The content of the dll is mapped to the current directory. If a required file matches a file in the dll (after resolving), then the file from the dll is used instead.

Because this happens after resolving every file in the dll bundle, the same paths must be available for the consumer of the dll bundle. i.e. if the dll contains lodash and the file abc, require("lodash") and require("./abc") will be used from the dll, rather than building them into the main bundle.


DllReferencePlugin and DllPlugin are used in separate webpack configs.


new webpack.DllPlugin({
  context: __dirname,
  name: "[name]_[hash]",
  path: path.join(__dirname, "manifest.json"),


new webpack.DllReferencePlugin({
  context: __dirname,
  manifest: require("./manifest.json"),
  name: "./my-dll.js",
  scope: "xyz",
  sourceType: "commonjs2"


Vendor and User

Two separate example folders. Demonstrates scope and context.

Multiple DllPlugins and multiple DllReferencePlugins.




Further Reading