2017-04-20 03:45:42 +08:00
|
|
|
# DllReference
|
|
|
|
|
|
|
|
|
|
[DllPlugin documentation](https://webpack.js.org/plugins/dll-plugin)
|
|
|
|
|
|
2021-06-28 17:46:10 +08:00
|
|
|
This is the _reference_ bundle (with the manifests) for [dll user example](https://github.com/webpack/webpack/tree/main/examples/dll-user)
|
2017-04-20 03:45:42 +08:00
|
|
|
|
2015-05-17 00:27:59 +08:00
|
|
|
# webpack.config.js
|
|
|
|
|
|
2019-04-09 02:29:40 +08:00
|
|
|
```javascript
|
2025-04-25 01:57:25 +08:00
|
|
|
const path = require("path");
|
|
|
|
|
const webpack = require("../../");
|
|
|
|
|
|
2015-05-17 00:27:59 +08:00
|
|
|
module.exports = {
|
2023-03-12 10:27:40 +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: {
|
2018-01-05 04:39:29 +08:00
|
|
|
path: path.join(__dirname, "dist"),
|
2015-05-17 00:27:59 +08:00
|
|
|
filename: "MyDll.[name].js",
|
2019-01-28 09:27:57 +08:00
|
|
|
library: "[name]_[fullhash]"
|
2015-05-17 00:27:59 +08:00
|
|
|
},
|
|
|
|
|
plugins: [
|
2015-06-13 23:41:14 +08:00
|
|
|
new webpack.DllPlugin({
|
2018-01-05 04:39:29 +08:00
|
|
|
path: path.join(__dirname, "dist", "[name]-manifest.json"),
|
2019-01-28 09:27:57 +08:00
|
|
|
name: "[name]_[fullhash]"
|
2015-05-17 00:27:59 +08:00
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
2018-01-05 04:39:29 +08:00
|
|
|
# dist/MyDll.alpha.js
|
2015-05-17 00:27:59 +08:00
|
|
|
|
2019-04-09 02:29:40 +08:00
|
|
|
```javascript
|
2025-04-25 01:57:25 +08:00
|
|
|
var alpha_2239422b902ff2ef1cc1;
|
2019-10-11 05:11:05 +08:00
|
|
|
/******/ (() => { // webpackBootstrap
|
|
|
|
|
/******/ var __webpack_modules__ = ([
|
2015-05-17 00:27:59 +08:00
|
|
|
/* 0 */
|
2017-06-05 22:12:12 +08:00
|
|
|
/*!*****************!*\
|
|
|
|
|
!*** dll alpha ***!
|
|
|
|
|
\*****************/
|
2020-05-21 05:26:51 +08:00
|
|
|
/*! unknown exports (runtime-defined) */
|
2019-08-05 19:32:25 +08:00
|
|
|
/*! runtime requirements: __webpack_require__, module */
|
2019-10-11 05:11:05 +08:00
|
|
|
/***/ ((module, __unused_webpack_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 ***!
|
|
|
|
|
\******************/
|
2020-05-21 05:26:51 +08:00
|
|
|
/*! unknown exports (runtime-defined) */
|
2018-12-19 21:05:17 +08:00
|
|
|
/*! runtime requirements: module */
|
2020-09-21 04:39:12 +08:00
|
|
|
/*! CommonJS bailout: module.exports is used directly at 1:0-14 */
|
2019-10-09 05:45:47 +08:00
|
|
|
/***/ ((module) => {
|
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 ***!
|
|
|
|
|
\**************/
|
2020-05-21 05:26:51 +08:00
|
|
|
/*! unknown exports (runtime-defined) */
|
2018-12-19 21:05:17 +08:00
|
|
|
/*! runtime requirements: module */
|
2020-09-21 04:39:12 +08:00
|
|
|
/*! CommonJS bailout: module.exports is used directly at 1:0-14 */
|
2019-10-09 05:45:47 +08:00
|
|
|
/***/ ((module) => {
|
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 ***!
|
|
|
|
|
\*********************************/
|
2020-05-21 05:26:51 +08:00
|
|
|
/*! unknown exports (runtime-defined) */
|
2018-12-19 21:05:17 +08:00
|
|
|
/*! runtime requirements: module */
|
2020-09-21 04:39:12 +08:00
|
|
|
/*! CommonJS bailout: module.exports is used directly at 1:0-14 */
|
2019-10-09 05:45:47 +08:00
|
|
|
/***/ ((module) => {
|
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
|
|
|
|
2025-04-25 01:57:25 +08:00
|
|
|
|
2017-03-31 02:25:01 +08:00
|
|
|
/***/ })
|
2019-10-11 05:11:05 +08:00
|
|
|
/******/ ]);
|
2019-11-19 21:10:28 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<details><summary><code>/* webpack runtime code */</code></summary>
|
|
|
|
|
|
2021-08-20 14:12:50 +08:00
|
|
|
``` js
|
2019-10-11 05:11:05 +08:00
|
|
|
/************************************************************************/
|
2021-08-20 14:12:50 +08:00
|
|
|
/******/ // The module cache
|
|
|
|
|
/******/ var __webpack_module_cache__ = {};
|
|
|
|
|
/******/
|
|
|
|
|
/******/ // The require function
|
|
|
|
|
/******/ function __webpack_require__(moduleId) {
|
|
|
|
|
/******/ // Check if module is in cache
|
|
|
|
|
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
|
|
|
/******/ if (cachedModule !== undefined) {
|
|
|
|
|
/******/ return cachedModule.exports;
|
|
|
|
|
/******/ }
|
|
|
|
|
/******/ // Create a new module (and put it into the cache)
|
|
|
|
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
|
|
|
/******/ // no module.id needed
|
|
|
|
|
/******/ // no module.loaded needed
|
|
|
|
|
/******/ exports: {}
|
|
|
|
|
/******/ };
|
|
|
|
|
/******/
|
|
|
|
|
/******/ // Execute the module function
|
|
|
|
|
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
|
|
|
/******/
|
|
|
|
|
/******/ // Return the exports of the module
|
|
|
|
|
/******/ return module.exports;
|
|
|
|
|
/******/ }
|
|
|
|
|
/******/
|
2019-10-11 05:11:05 +08:00
|
|
|
/************************************************************************/
|
2019-11-19 21:10:28 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
2021-08-20 14:12:50 +08:00
|
|
|
``` js
|
|
|
|
|
/******/
|
2019-10-11 05:11:05 +08:00
|
|
|
/******/ // startup
|
|
|
|
|
/******/ // Load entry module and return exports
|
2021-08-20 14:12:50 +08:00
|
|
|
/******/ // This entry module doesn't tell about it's top-level declarations so it can't be inlined
|
|
|
|
|
/******/ var __webpack_exports__ = __webpack_require__(0);
|
2025-04-25 01:57:25 +08:00
|
|
|
/******/ alpha_2239422b902ff2ef1cc1 = __webpack_exports__;
|
2021-08-20 14:12:50 +08:00
|
|
|
/******/
|
2019-10-11 05:11:05 +08:00
|
|
|
/******/ })()
|
|
|
|
|
;
|
2015-05-17 00:27:59 +08:00
|
|
|
```
|
|
|
|
|
|
2018-01-05 04:39:29 +08:00
|
|
|
# dist/alpha-manifest.json
|
2015-05-17 00:27:59 +08:00
|
|
|
|
2019-04-09 02:29:40 +08:00
|
|
|
```javascript
|
2025-04-25 01:57:25 +08:00
|
|
|
{"name":"alpha_2239422b902ff2ef1cc1","content":{"./alpha.js":{"id":1,"buildMeta":{}},"./a.js":{"id":2,"buildMeta":{}},"../node_modules/module.js":{"id":3,"buildMeta":{}}}}
|
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
|
|
|
|
|
|
|
|
```
|
2021-08-20 14:12:50 +08:00
|
|
|
asset MyDll.alpha.js 2.58 KiB [emitted] (name: alpha)
|
|
|
|
|
asset MyDll.beta.js 2.55 KiB [emitted] (name: beta)
|
2025-04-25 01:57:25 +08:00
|
|
|
chunk (runtime: alpha) MyDll.alpha.js (alpha) 85 bytes [entry] [rendered]
|
2020-09-21 04:39:12 +08:00
|
|
|
> alpha
|
2025-04-25 01:57:25 +08:00
|
|
|
dependent modules 73 bytes [dependent] 3 modules
|
2020-09-21 04:39:12 +08:00
|
|
|
dll alpha 12 bytes [built] [code generated]
|
|
|
|
|
[used exports unknown]
|
2025-04-25 01:57:25 +08:00
|
|
|
dll entry 0:0-0
|
2020-09-21 04:39:12 +08:00
|
|
|
used as library export
|
2020-12-11 17:29:32 +08:00
|
|
|
chunk (runtime: beta) MyDll.beta.js (beta) 80 bytes [entry] [rendered]
|
2020-09-21 04:39:12 +08:00
|
|
|
> beta
|
|
|
|
|
dependent modules 68 bytes [dependent] 3 modules
|
|
|
|
|
dll beta 12 bytes [built] [code generated]
|
|
|
|
|
[used exports unknown]
|
2025-04-25 01:57:25 +08:00
|
|
|
dll entry 0:0-0
|
2020-09-21 04:39:12 +08:00
|
|
|
used as library export
|
2025-04-25 20:13:46 +08:00
|
|
|
webpack 5.99.7 compiled successfully
|
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
|
|
|
|
|
|
|
|
```
|
2021-08-20 14:12:50 +08:00
|
|
|
asset MyDll.alpha.js 313 bytes [emitted] [minimized] (name: alpha)
|
2025-04-25 01:57:25 +08:00
|
|
|
asset MyDll.beta.js 307 bytes [emitted] [minimized] (name: beta)
|
2020-09-21 04:39:12 +08:00
|
|
|
chunk (runtime: beta) MyDll.beta.js (beta) 80 bytes [entry] [rendered]
|
|
|
|
|
> beta
|
|
|
|
|
dependent modules 68 bytes [dependent] 3 modules
|
|
|
|
|
dll beta 12 bytes [built] [code generated]
|
2025-04-25 01:57:25 +08:00
|
|
|
dll entry 0:0-0
|
|
|
|
|
used as library export
|
|
|
|
|
chunk (runtime: alpha) MyDll.alpha.js (alpha) 85 bytes [entry] [rendered]
|
|
|
|
|
> alpha
|
|
|
|
|
dependent modules 73 bytes [dependent] 3 modules
|
|
|
|
|
dll alpha 12 bytes [built] [code generated]
|
|
|
|
|
dll entry 0:0-0
|
2020-09-21 04:39:12 +08:00
|
|
|
used as library export
|
2025-04-25 20:13:46 +08:00
|
|
|
webpack 5.99.7 compiled successfully
|
2017-04-20 03:45:42 +08:00
|
|
|
```
|