|
| 1 | +# webpack.config.js |
| 2 | + |
| 3 | +``` javascript |
| 4 | +var path = require("path"); |
| 5 | +var DllPlugin = require("../../lib/DllPlugin"); |
| 6 | +module.exports = { |
| 7 | + entry: { |
| 8 | + alpha: ["./alpha", "./a"], |
| 9 | + beta: ["./beta", "./b"] |
| 10 | + }, |
| 11 | + output: { |
| 12 | + path: path.join(__dirname, "js"), |
| 13 | + filename: "MyDll.[name].js", |
| 14 | + library: "[name]_[hash]" |
| 15 | + }, |
| 16 | + plugins: [ |
| 17 | + new DllPlugin({ |
| 18 | + path: path.join(__dirname, "js", "[name]-manifest.json"), |
| 19 | + name: "[name]_[hash]" |
| 20 | + }) |
| 21 | + ] |
| 22 | +}; |
| 23 | +``` |
| 24 | + |
| 25 | +# js/MyDll.alpha.js |
| 26 | + |
| 27 | +``` javascript |
| 28 | +var alpha_fda802f3c408a66ef744 = |
| 29 | +/******/ (function(modules) { // webpackBootstrap |
| 30 | +/******/ // The module cache |
| 31 | +/******/ var installedModules = {}; |
| 32 | + |
| 33 | +/******/ // The require function |
| 34 | +/******/ function __webpack_require__(moduleId) { |
| 35 | + |
| 36 | +/******/ // Check if module is in cache |
| 37 | +/******/ if(installedModules[moduleId]) |
| 38 | +/******/ return installedModules[moduleId].exports; |
| 39 | + |
| 40 | +/******/ // Create a new module (and put it into the cache) |
| 41 | +/******/ var module = installedModules[moduleId] = { |
| 42 | +/******/ exports: {}, |
| 43 | +/******/ id: moduleId, |
| 44 | +/******/ loaded: false |
| 45 | +/******/ }; |
| 46 | + |
| 47 | +/******/ // Execute the module function |
| 48 | +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
| 49 | + |
| 50 | +/******/ // Flag the module as loaded |
| 51 | +/******/ module.loaded = true; |
| 52 | + |
| 53 | +/******/ // Return the exports of the module |
| 54 | +/******/ return module.exports; |
| 55 | +/******/ } |
| 56 | + |
| 57 | + |
| 58 | +/******/ // expose the modules object (__webpack_modules__) |
| 59 | +/******/ __webpack_require__.m = modules; |
| 60 | + |
| 61 | +/******/ // expose the module cache |
| 62 | +/******/ __webpack_require__.c = installedModules; |
| 63 | + |
| 64 | +/******/ // __webpack_public_path__ |
| 65 | +/******/ __webpack_require__.p = "js/"; |
| 66 | + |
| 67 | +/******/ // Load entry module and return exports |
| 68 | +/******/ return __webpack_require__(0); |
| 69 | +/******/ }) |
| 70 | +/************************************************************************/ |
| 71 | +/******/ ([ |
| 72 | +/* 0 */ |
| 73 | +/*!*****************!*\ |
| 74 | + !*** dll alpha ***! |
| 75 | + \*****************/ |
| 76 | +/***/ function(module, exports, __webpack_require__) { |
| 77 | + |
| 78 | + module.exports = __webpack_require__; |
| 79 | + |
| 80 | +/***/ }, |
| 81 | +/* 1 */ |
| 82 | +/*!******************!*\ |
| 83 | + !*** ./alpha.js ***! |
| 84 | + \******************/ |
| 85 | +/***/ function(module, exports, __webpack_require__) { |
| 86 | + |
| 87 | + module.exports = "alpha"; |
| 88 | + |
| 89 | +/***/ }, |
| 90 | +/* 2 */ |
| 91 | +/*!**************!*\ |
| 92 | + !*** ./a.js ***! |
| 93 | + \**************/ |
| 94 | +/***/ function(module, exports, __webpack_require__) { |
| 95 | + |
| 96 | + module.exports = "a"; |
| 97 | + |
| 98 | +/***/ } |
| 99 | +/******/ ]); |
| 100 | +``` |
| 101 | + |
| 102 | +# js/MyDll.beta.js |
| 103 | + |
| 104 | +``` javascript |
| 105 | +var beta_fda802f3c408a66ef744 = |
| 106 | +/******/ (function(modules) { // webpackBootstrap |
| 107 | +/******/ // The module cache |
| 108 | +/******/ var installedModules = {}; |
| 109 | + |
| 110 | +/******/ // The require function |
| 111 | +/******/ function __webpack_require__(moduleId) { |
| 112 | + |
| 113 | +/******/ // Check if module is in cache |
| 114 | +/******/ if(installedModules[moduleId]) |
| 115 | +/******/ return installedModules[moduleId].exports; |
| 116 | + |
| 117 | +/******/ // Create a new module (and put it into the cache) |
| 118 | +/******/ var module = installedModules[moduleId] = { |
| 119 | +/******/ exports: {}, |
| 120 | +/******/ id: moduleId, |
| 121 | +/******/ loaded: false |
| 122 | +/******/ }; |
| 123 | + |
| 124 | +/******/ // Execute the module function |
| 125 | +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
| 126 | + |
| 127 | +/******/ // Flag the module as loaded |
| 128 | +/******/ module.loaded = true; |
| 129 | + |
| 130 | +/******/ // Return the exports of the module |
| 131 | +/******/ return module.exports; |
| 132 | +/******/ } |
| 133 | + |
| 134 | + |
| 135 | +/******/ // expose the modules object (__webpack_modules__) |
| 136 | +/******/ __webpack_require__.m = modules; |
| 137 | + |
| 138 | +/******/ // expose the module cache |
| 139 | +/******/ __webpack_require__.c = installedModules; |
| 140 | + |
| 141 | +/******/ // __webpack_public_path__ |
| 142 | +/******/ __webpack_require__.p = "js/"; |
| 143 | + |
| 144 | +/******/ // Load entry module and return exports |
| 145 | +/******/ return __webpack_require__(0); |
| 146 | +/******/ }) |
| 147 | +/************************************************************************/ |
| 148 | +/******/ ([ |
| 149 | +/* 0 */ |
| 150 | +/*!****************!*\ |
| 151 | + !*** dll beta ***! |
| 152 | + \****************/ |
| 153 | +/***/ function(module, exports, __webpack_require__) { |
| 154 | + |
| 155 | + module.exports = __webpack_require__; |
| 156 | + |
| 157 | +/***/ }, |
| 158 | +/* 1 */, |
| 159 | +/* 2 */, |
| 160 | +/* 3 */ |
| 161 | +/*!*****************!*\ |
| 162 | + !*** ./beta.js ***! |
| 163 | + \*****************/ |
| 164 | +/***/ function(module, exports, __webpack_require__) { |
| 165 | + |
| 166 | + module.exports = "beta"; |
| 167 | + |
| 168 | +/***/ }, |
| 169 | +/* 4 */ |
| 170 | +/*!**************!*\ |
| 171 | + !*** ./b.js ***! |
| 172 | + \**************/ |
| 173 | +/***/ function(module, exports, __webpack_require__) { |
| 174 | + |
| 175 | + module.exports = "b"; |
| 176 | + |
| 177 | +/***/ } |
| 178 | +/******/ ]); |
| 179 | +``` |
| 180 | + |
| 181 | +# Info |
| 182 | + |
| 183 | +## Uncompressed |
| 184 | + |
| 185 | +``` |
| 186 | +Hash: fda802f3c408a66ef744 |
| 187 | +Version: webpack 1.9.5 |
| 188 | +Time: 54ms |
| 189 | + Asset Size Chunks Chunk Names |
| 190 | +MyDll.alpha.js 1.88 kB 0 [emitted] alpha |
| 191 | + MyDll.beta.js 1.89 kB 1 [emitted] beta |
| 192 | +chunk {0} MyDll.alpha.js (alpha) 58 bytes [rendered] |
| 193 | + > alpha [0] dll alpha |
| 194 | + [0] dll alpha 12 bytes {0} [built] |
| 195 | + [1] ./alpha.js 25 bytes {0} [built] |
| 196 | + single entry ./alpha [0] dll alpha |
| 197 | + [2] ./a.js 21 bytes {0} [built] |
| 198 | + single entry ./a [0] dll alpha |
| 199 | +chunk {1} MyDll.beta.js (beta) 57 bytes [rendered] |
| 200 | + > beta [0] dll beta |
| 201 | + [0] dll beta 12 bytes {1} [built] |
| 202 | + [3] ./beta.js 24 bytes {1} [built] |
| 203 | + single entry ./beta [0] dll beta |
| 204 | + [4] ./b.js 21 bytes {1} [built] |
| 205 | + single entry ./b [0] dll beta |
| 206 | +``` |
| 207 | + |
| 208 | +## Minimized (uglify-js, no zip) |
| 209 | + |
| 210 | +``` |
| 211 | +Hash: 28b01778c3ed267edad7 |
| 212 | +Version: webpack 1.9.5 |
| 213 | +Time: 129ms |
| 214 | + Asset Size Chunks Chunk Names |
| 215 | + MyDll.beta.js 330 bytes 0 [emitted] beta |
| 216 | +MyDll.alpha.js 330 bytes 1 [emitted] alpha |
| 217 | +chunk {0} MyDll.beta.js (beta) 57 bytes [rendered] |
| 218 | + > beta [0] dll beta |
| 219 | + [0] dll beta 12 bytes {0} [built] |
| 220 | + [3] ./b.js 21 bytes {0} [built] |
| 221 | + single entry ./b [0] dll beta |
| 222 | + [4] ./beta.js 24 bytes {0} [built] |
| 223 | + single entry ./beta [0] dll beta |
| 224 | +chunk {1} MyDll.alpha.js (alpha) 58 bytes [rendered] |
| 225 | + > alpha [0] dll alpha |
| 226 | + [0] dll alpha 12 bytes {1} [built] |
| 227 | + [1] ./a.js 21 bytes {1} [built] |
| 228 | + single entry ./a [0] dll alpha |
| 229 | + [2] ./alpha.js 25 bytes {1} [built] |
| 230 | + single entry ./alpha [0] dll alpha |
| 231 | +``` |
0 commit comments