webpack/examples/dll/README.md

250 lines
6.8 KiB
Markdown
Raw Normal View History

# DllReference
[DllPlugin documentation](https://webpack.js.org/plugins/dll-plugin)
This is the _reference_ bundle (with the manifests) for [dll user example](https://github.com/webpack/webpack/tree/master/examples/dll-user)
2015-05-17 00:27:59 +08:00
# webpack.config.js
``` javascript
var path = require("path");
2015-06-13 23:41:14 +08:00
var webpack = require("../../");
2015-05-17 00:27:59 +08:00
module.exports = {
2017-12-14 17:58:03 +08:00
// mode: "development || "production",
2016-09-07 20:57:53 +08:00
resolve: {
2017-03-31 02:25:01 +08:00
extensions: [".js", ".jsx"]
2016-09-07 20:57:53 +08:00
},
2015-05-17 00:27:59 +08:00
entry: {
2015-10-13 22:19:11 +08:00
alpha: ["./alpha", "./a", "module"],
2016-09-07 20:57:53 +08:00
beta: ["./beta", "./b", "./c"]
2015-05-17 00:27:59 +08:00
},
output: {
path: path.join(__dirname, "js"),
filename: "MyDll.[name].js",
library: "[name]_[hash]"
},
plugins: [
2015-06-13 23:41:14 +08:00
new webpack.DllPlugin({
2015-05-17 00:27:59 +08:00
path: path.join(__dirname, "js", "[name]-manifest.json"),
name: "[name]_[hash]"
})
]
};
```
# js/MyDll.alpha.js
``` javascript
2018-01-03 18:03:20 +08:00
var alpha_a716524c34bed97b283e =
2016-12-14 19:03:24 +08:00
```
2017-03-31 02:42:42 +08:00
<details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary>
2016-12-14 19:03:24 +08:00
``` js
2015-05-17 00:27:59 +08:00
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
2017-03-31 02:25:01 +08:00
/******/
2015-05-17 00:27:59 +08:00
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
2017-03-31 02:25:01 +08:00
/******/
2015-05-17 00:27:59 +08:00
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
2015-05-17 00:27:59 +08:00
/******/ return installedModules[moduleId].exports;
/******/ }
2015-05-17 00:27:59 +08:00
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
2016-06-06 02:51:44 +08:00
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
2015-05-17 00:27:59 +08:00
/******/ };
2017-03-31 02:25:01 +08:00
/******/
2015-05-17 00:27:59 +08:00
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
2017-03-31 02:25:01 +08:00
/******/
2015-05-17 00:27:59 +08:00
/******/ // Flag the module as loaded
2016-06-06 02:51:44 +08:00
/******/ module.l = true;
2017-03-31 02:25:01 +08:00
/******/
2015-05-17 00:27:59 +08:00
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
2017-03-31 02:25:01 +08:00
/******/
/******/
2015-05-17 00:27:59 +08:00
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
2017-03-31 02:25:01 +08:00
/******/
2015-05-17 00:27:59 +08:00
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
2017-03-31 02:25:01 +08:00
/******/
2016-12-08 02:14:47 +08:00
/******/ // define getter function for harmony exports
2016-09-07 18:28:56 +08:00
/******/ __webpack_require__.d = function(exports, name, getter) {
2016-12-14 19:03:24 +08:00
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
2016-09-07 18:28:56 +08:00
/******/ };
2017-03-31 02:25:01 +08:00
/******/
2017-11-24 15:40:39 +08:00
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
2016-09-07 18:28:56 +08:00
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
2017-03-31 02:25:01 +08:00
/******/
2016-09-07 18:28:56 +08:00
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
2017-03-31 02:25:01 +08:00
/******/
2015-05-17 00:27:59 +08:00
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "js/";
2017-03-31 02:25:01 +08:00
/******/
2015-05-17 00:27:59 +08:00
/******/ // Load entry module and return exports
2017-06-05 22:12:12 +08:00
/******/ return __webpack_require__(__webpack_require__.s = 0);
2015-05-17 00:27:59 +08:00
/******/ })
/************************************************************************/
2016-12-14 19:03:24 +08:00
```
2017-03-31 02:42:42 +08:00
2016-12-14 19:03:24 +08:00
</details>
2017-03-31 02:42:42 +08:00
2016-12-14 19:03:24 +08:00
``` js
2015-05-17 00:27:59 +08:00
/******/ ([
/* 0 */
2017-06-05 22:12:12 +08:00
/*!*****************!*\
!*** dll alpha ***!
\*****************/
/*! no static exports found */
/*! all exports used */
/***/ (function(module, exports, __webpack_require__) {
2015-05-17 00:27:59 +08:00
2017-06-05 22:12:12 +08:00
module.exports = __webpack_require__;
2015-05-17 00:27:59 +08:00
2017-03-31 02:25:01 +08:00
/***/ }),
2015-05-17 00:27:59 +08:00
/* 1 */
/*!******************!*\
!*** ./alpha.js ***!
\******************/
2017-06-05 22:12:12 +08:00
/*! no static exports found */
/*! all exports used */
2017-03-31 02:25:01 +08:00
/***/ (function(module, exports) {
2015-05-17 00:27:59 +08:00
2016-09-07 18:28:56 +08:00
module.exports = "alpha";
2015-05-17 00:27:59 +08:00
2017-03-31 02:25:01 +08:00
/***/ }),
2017-06-05 22:12:12 +08:00
/* 2 */
/*!**************!*\
!*** ./a.js ***!
\**************/
/*! no static exports found */
/*! all exports used */
2017-03-31 02:25:01 +08:00
/***/ (function(module, exports) {
2015-10-13 22:19:11 +08:00
2017-06-05 22:12:12 +08:00
module.exports = "a";
2015-10-13 22:19:11 +08:00
2017-03-31 02:25:01 +08:00
/***/ }),
2017-06-05 22:12:12 +08:00
/* 3 */
/*!*********************************!*\
!*** ../node_modules/module.js ***!
\*********************************/
/*! no static exports found */
/*! all exports used */
/***/ (function(module, exports) {
2016-02-04 07:27:47 +08:00
2017-06-05 22:12:12 +08:00
module.exports = "module";
2016-02-04 07:27:47 +08:00
2017-03-31 02:25:01 +08:00
/***/ })
2015-05-17 00:27:59 +08:00
/******/ ]);
```
2015-05-17 17:06:35 +08:00
# js/alpha-manifest.json
2015-05-17 00:27:59 +08:00
``` javascript
2018-01-03 18:03:20 +08:00
{"name":"alpha_a716524c34bed97b283e","content":{"./alpha.js":{"id":1,"buildMeta":{"providedExports":true}},"./a.js":{"id":2,"buildMeta":{"providedExports":true}},"../node_modules/module.js":{"id":3,"buildMeta":{"providedExports":true}}}}
2015-05-17 00:27:59 +08:00
```
# Info
2017-12-14 17:58:03 +08:00
## Unoptimized
2015-05-17 00:27:59 +08:00
```
2017-12-14 17:58:03 +08:00
Hash: 0a1b2c3d4e5f6a7b8c9d
2017-11-23 16:47:19 +08:00
Version: webpack next
Asset Size Chunks Chunk Names
2017-12-14 17:58:03 +08:00
MyDll.alpha.js 3.45 KiB 0 [emitted] alpha
MyDll.beta.js 3.42 KiB 1 [emitted] beta
2016-09-07 18:28:56 +08:00
Entrypoint alpha = MyDll.alpha.js
Entrypoint beta = MyDll.beta.js
2017-12-14 17:58:03 +08:00
chunk {0} MyDll.alpha.js (alpha) 84 bytes [entry] [rendered]
> alpha [0] dll alpha
[0] dll alpha 12 bytes {0} [built]
dll entry
[1] ./alpha.js 25 bytes {0} [built]
single entry ./alpha [0] dll alpha alpha:0
[2] ./a.js 21 bytes {0} [built]
single entry ./a [0] dll alpha alpha:1
+ 1 hidden module
chunk {1} MyDll.beta.js (beta) 80 bytes [entry] [rendered]
2017-06-05 22:12:12 +08:00
> beta [4] dll beta
2017-12-14 17:58:03 +08:00
[4] dll beta 12 bytes {1} [built]
2017-11-23 16:47:19 +08:00
dll entry
2017-12-14 17:58:03 +08:00
[5] ./beta.js 24 bytes {1} [built]
2017-11-23 16:47:19 +08:00
2017-06-05 22:12:12 +08:00
single entry ./beta [4] dll beta beta:0
2017-12-14 17:58:03 +08:00
[6] ./b.js 21 bytes {1} [built]
2017-11-23 16:47:19 +08:00
2017-06-05 22:12:12 +08:00
single entry ./b [4] dll beta beta:1
2017-12-14 17:58:03 +08:00
[7] ./c.jsx 23 bytes {1} [built]
2017-11-23 16:47:19 +08:00
2017-06-05 22:12:12 +08:00
single entry ./c [4] dll beta beta:2
2015-05-17 00:27:59 +08:00
```
2017-12-14 17:58:03 +08:00
## Production mode
2015-05-17 00:27:59 +08:00
```
2017-12-14 17:58:03 +08:00
Hash: 0a1b2c3d4e5f6a7b8c9d
2017-11-23 16:47:19 +08:00
Version: webpack next
2015-05-17 00:27:59 +08:00
Asset Size Chunks Chunk Names
2017-12-21 18:19:53 +08:00
MyDll.beta.js 689 bytes 0 [emitted] beta
MyDll.alpha.js 698 bytes 1 [emitted] alpha
2016-09-07 18:28:56 +08:00
Entrypoint alpha = MyDll.alpha.js
Entrypoint beta = MyDll.beta.js
2016-09-07 20:57:53 +08:00
chunk {0} MyDll.beta.js (beta) 80 bytes [entry] [rendered]
2017-12-21 18:19:53 +08:00
> beta [3] dll beta
[0] ./c.jsx 23 bytes {0} [built]
2017-11-23 16:47:19 +08:00
2017-12-21 18:19:53 +08:00
single entry ./c [3] dll beta beta:2
[1] ./b.js 21 bytes {0} [built]
2017-11-23 16:47:19 +08:00
2017-12-21 18:19:53 +08:00
single entry ./b [3] dll beta beta:1
[2] ./beta.js 24 bytes {0} [built]
2017-11-23 16:47:19 +08:00
2017-12-21 18:19:53 +08:00
single entry ./beta [3] dll beta beta:0
[3] dll beta 12 bytes {0} [built]
dll entry
2017-11-23 16:47:19 +08:00
2016-09-07 20:57:53 +08:00
chunk {1} MyDll.alpha.js (alpha) 84 bytes [entry] [rendered]
2017-12-21 18:19:53 +08:00
> alpha [7] dll alpha
[5] ./a.js 21 bytes {1} [built]
2017-11-23 16:47:19 +08:00
2017-12-21 18:19:53 +08:00
single entry ./a [7] dll alpha alpha:1
[6] ./alpha.js 25 bytes {1} [built]
2017-11-23 16:47:19 +08:00
2017-12-21 18:19:53 +08:00
single entry ./alpha [7] dll alpha alpha:0
[7] dll alpha 12 bytes {1} [built]
dll entry
2017-11-23 16:47:19 +08:00
2017-08-08 20:00:06 +08:00
+ 1 hidden module
```