Skip to content
This repository was archived by the owner on Dec 1, 2018. It is now read-only.

Commit 3df8a13

Browse files
committed
Added autodll-webpack-plugin
1 parent 2b9e001 commit 3df8a13

File tree

4 files changed

+37
-14
lines changed

4 files changed

+37
-14
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,12 @@ This project is inspired by several other projects:
2929
* Kcd-scripts: https://github.com/kentcdodds/kcd-scripts
3030

3131
I'd like to thank the owners/contributors of these great projects for their work. It definitely helped implementing what we saught after.
32+
33+
### Webpack DLL benchmarks
34+
build without DLL: 53156ms
35+
first rebuild with devserver: 25595ms
36+
second rebuild: 24511ms
37+
38+
first build with DLL creation: 29373ms
39+
second build without dll creation: 23126ms
40+
first rebuild with dll: 16551ms

config/webpack/webpack.config.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const { existsSync } = require('fs');
55
const chalk = require('chalk');
66
const webpack = require('webpack');
77
const autoprefixer = require('autoprefixer');
8+
const AutodllWebpackPlugin = require('autodll-webpack-plugin');
89
const HtmlWebpackPlugin = require('html-webpack-plugin');
910
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
1011
const CleanWebpackPlugin = require('clean-webpack-plugin');
@@ -17,6 +18,7 @@ const babelConfig = require('../babel/babel.config');
1718
const eslintConfig = require('../eslint/eslint.config');
1819
const { browsersList } = require('../globals');
1920
const polyfills = require('../polyfills');
21+
const pkgJson = require(resolveAppPath('package.json'));
2022

2123
const appPath = resolveAppPath('app');
2224
const buildPath = resolveAppPath('dist');
@@ -194,19 +196,19 @@ module.exports = (env = { dev: true }) => {
194196
//////////////////////////////////////////////////////////
195197
// DLL //
196198
//////////////////////////////////////////////////////////
197-
// ifDev(
198-
// new webpack.DllReferencePlugin({
199-
// context: '.',
200-
// manifest: resolve(buildPath, 'dll', 'manifest.json'),
201-
// })
202-
// ),
203-
204-
// ifDev(
205-
// new AddAssetHtmlPlugin({
206-
// filepath: resolve(buildPath, 'dll', 'vendors.js'),
207-
// includeSourcemap: false,
208-
// })
209-
// ),
199+
ifDev(
200+
new AutodllWebpackPlugin({
201+
inject: true,
202+
debug: true,
203+
filename: '[name]_[hash].js',
204+
path: './dll',
205+
entry: {
206+
vendorDll: Object.keys(pkgJson.dependencies).filter(
207+
dep => !pkgJson.dllIgnore.includes(dep)
208+
),
209+
},
210+
})
211+
),
210212

211213
//////////////////////////////////////////////////////////
212214
// Chunks //

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
},
2727
"dependencies": {
2828
"add-asset-html-webpack-plugin": "^2.1.1",
29+
"autodll-webpack-plugin": "^0.2.1",
2930
"autoprefixer": "^7.1.3",
3031
"babel-core": "^6.26.0",
3132
"babel-loader": "^7.1.2",

yarn.lock

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,17 @@ atob@~1.1.0:
281281
version "1.1.3"
282282
resolved "https://registry.yarnpkg.com/atob/-/atob-1.1.3.tgz#95f13629b12c3a51a5d215abdce2aa9f32f80773"
283283

284+
autodll-webpack-plugin@^0.2.1:
285+
version "0.2.1"
286+
resolved "https://registry.yarnpkg.com/autodll-webpack-plugin/-/autodll-webpack-plugin-0.2.1.tgz#74976a098d813ab1438fd5ca38f36c874d035d13"
287+
dependencies:
288+
bluebird "^3.5.0"
289+
del "^3.0.0"
290+
find-cache-dir "^1.0.0"
291+
lodash "^4.17.4"
292+
make-dir "^1.0.0"
293+
memory-fs "^0.4.1"
294+
284295
autoprefixer@^6.3.1:
285296
version "6.7.7"
286297
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-6.7.7.tgz#1dbd1c835658e35ce3f9984099db00585c782014"
@@ -3315,7 +3326,7 @@ [email protected]:
33153326
version "0.3.0"
33163327
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
33173328

3318-
memory-fs@^0.4.0, memory-fs@~0.4.1:
3329+
memory-fs@^0.4.0, memory-fs@^0.4.1, memory-fs@~0.4.1:
33193330
version "0.4.1"
33203331
resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552"
33213332
dependencies:

0 commit comments

Comments
 (0)