Skip to content

Latest commit

 

History

History
54 lines (41 loc) · 1.13 KB

why-use-dll-link.md

File metadata and controls

54 lines (41 loc) · 1.13 KB

When using DllReferencePlugin,you will have to indicate the manifest file or context.

var webpack = require('webpack');

module.exports = {
    // ...
    plugins: [
        new webpack.DllReferencePlugin({
            context: '.',
            manifest: require('xxxx-manifest.json'),
        })
    ]
};

And then compile manually.

$ webpack --config webpack.dll.config.js
$ webpack --config webpack.config.js

When vendors change, compile manually again...

$ webpack --config webpack.dll.config.js
$ webpack --config webpack.config.js

Let's see how things are different with DllLinkPlugin.

The config file changes to

var DllLinkPlugin = require('dll-link-webpack-plugin');

module.exports = {
    // ...
    plugins: [
        new DllLinkPlugin({
            config: require('webpack.dll.config.js')
        })
    ]
}

No DllReferencePlugin any more, then compile.

$ webpack --config webpack.config.js

That's it! What you have to do is require the normal dll config file. Every time you run the above command, it will help you to detect the change and rebuild the vendors file automatically.