webpack/examples/common-chunk-and-vendor-chunk/README.md

794 lines
28 KiB
Markdown
Raw Normal View History

2017-05-13 23:29:55 +08:00
This example shows how to create an explicit vendor chunk as well as a common chunk for code shared among entry points. In this example, we have 3 entry points: `pageA`, `pageB`, and `pageC`. Those entry points share some of the same utility modules, but not others. This configuration will pull out any modules common to at least 2 bundles and place it in the `common` bundle instead, all while keeping the specified vendor libraries in their own bundle by themselves.
2016-01-04 11:07:08 +08:00
To better understand, here are the entry points and which utility modules they depend on:
- `pageA`
2017-04-18 02:03:09 +08:00
- `utility1`
- `utility2`
2016-01-04 11:07:08 +08:00
- `pageB`
2017-04-18 02:03:09 +08:00
- `utility2`
- `utility3`
2016-01-04 11:07:08 +08:00
- `pageC`
2017-04-18 02:03:09 +08:00
- `utility2`
- `utility3`
2016-01-04 11:07:08 +08:00
Given this configuration, webpack will produce the following bundles:
- `vendor`
2017-04-18 02:03:09 +08:00
- webpack runtime
- `vendor1`
- `vendor2`
2016-01-04 11:07:08 +08:00
- `common`
2017-04-18 02:03:09 +08:00
- `utility2`
- `utility3`
2016-01-04 11:07:08 +08:00
- `pageA`
2017-04-18 02:03:09 +08:00
- `pageA`
- `utility1`
2016-01-04 11:07:08 +08:00
- `pageB`
2017-04-18 02:03:09 +08:00
- `pageB`
2016-01-04 11:07:08 +08:00
- `pageC`
2017-04-18 02:03:09 +08:00
- `pageC`
2016-01-04 11:07:08 +08:00
With this bundle configuration, you would load your third party libraries, then your common application code, then your page-specific application code.
# webpack.config.js
2019-04-09 02:29:40 +08:00
```javascript
2016-01-04 11:07:08 +08:00
var path = require("path");
module.exports = {
2017-12-14 17:58:03 +08:00
// mode: "development" || "production",
2016-01-04 11:07:08 +08:00
entry: {
pageA: "./pageA",
pageB: "./pageB",
pageC: "./pageC"
},
optimization: {
2018-12-19 21:05:17 +08:00
chunkIds: "named",
splitChunks: {
cacheGroups: {
2018-01-22 22:18:54 +08:00
commons: {
chunks: "initial",
minChunks: 2,
2018-02-17 21:14:14 +08:00
maxInitialRequests: 5, // The default limit is too small to showcase the effect
2018-01-22 22:18:54 +08:00
minSize: 0 // This is example is too small to create commons chunks
},
vendor: {
test: /node_modules/,
2018-01-22 22:18:54 +08:00
chunks: "initial",
name: "vendor",
2018-02-17 21:14:14 +08:00
priority: 10,
enforce: true
}
}
}
2016-01-04 11:07:08 +08:00
},
output: {
path: path.join(__dirname, "dist"),
2016-01-04 11:07:08 +08:00
filename: "[name].js"
}
2016-01-04 11:07:08 +08:00
};
```
# dist/vendor.js
2016-01-04 11:07:08 +08:00
2019-04-09 02:29:40 +08:00
```javascript
2020-09-21 04:39:12 +08:00
(self["webpackChunk"] = self["webpackChunk"] || []).push([["vendor"],{
/***/ 1:
/*!*********************************!*\
!*** ./node_modules/vendor1.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) => {
module.exports = "vendor1";
/***/ }),
/***/ 5:
/*!*********************************!*\
!*** ./node_modules/vendor2.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) => {
module.exports = "vendor2";
/***/ })
}]);
```
2018-12-19 21:05:17 +08:00
# dist/commons-utility2_js.js
``` javascript
2020-09-21 04:39:12 +08:00
(self["webpackChunk"] = self["webpackChunk"] || []).push([["commons-utility2_js"],{
/***/ 3:
/*!*********************!*\
!*** ./utility2.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) => {
module.exports = "utility2";
2018-01-22 22:18:54 +08:00
/***/ })
}]);
```
2018-12-19 21:05:17 +08:00
# dist/commons-utility3_js.js
2018-01-22 22:18:54 +08:00
``` javascript
2020-09-21 04:39:12 +08:00
(self["webpackChunk"] = self["webpackChunk"] || []).push([["commons-utility3_js"],{
/***/ 6:
/*!*********************!*\
!*** ./utility3.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) => {
module.exports = "utility3";
/***/ })
}]);
```
# dist/pageA.js
2019-04-09 02:29:40 +08:00
```javascript
2019-10-11 05:11:05 +08:00
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ([
2017-12-14 17:58:03 +08:00
/* 0 */
2016-01-04 11:07:08 +08:00
/*!******************!*\
!*** ./pageA.js ***!
\******************/
2020-05-21 05:26:51 +08:00
/*! unknown exports (runtime-defined) */
/*! runtime requirements: module, __webpack_require__ */
2020-09-21 04:39:12 +08:00
/*! CommonJS bailout: module.exports is used directly at 5:0-14 */
2019-10-11 05:11:05 +08:00
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2016-01-04 11:07:08 +08:00
var vendor1 = __webpack_require__(/*! vendor1 */ 1);
var utility1 = __webpack_require__(/*! ./utility1 */ 2);
var utility2 = __webpack_require__(/*! ./utility2 */ 3);
2016-01-04 11:07:08 +08:00
2016-09-07 18:28:56 +08:00
module.exports = "pageA";
2016-01-04 11:07:08 +08:00
2017-06-05 22:12:12 +08:00
/***/ }),
/* 1 */,
/* 2 */
2017-06-05 22:12:12 +08:00
/*!*********************!*\
!*** ./utility1.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) => {
2017-06-05 22:12:12 +08:00
module.exports = "utility1";
2017-03-31 02:25:01 +08:00
/***/ })
2019-10-11 05:11:05 +08:00
/******/ ]);
```
<details><summary><code>/* webpack runtime code */</code></summary>
``` js
2019-10-11 05:11:05 +08:00
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
2020-05-21 05:26:51 +08:00
/******/ // no module.id needed
/******/ // no module.loaded needed
2019-10-11 05:11:05 +08:00
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/******/ // the startup function
/******/ // It's empty as some runtime module handles the default behavior
/******/ __webpack_require__.x = x => {}
2019-10-11 05:11:05 +08:00
/************************************************************************/
2020-05-21 05:26:51 +08:00
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
/******/ })();
/******/
2018-12-19 21:05:17 +08:00
/******/ /* webpack/runtime/jsonp chunk loading */
2020-05-21 05:26:51 +08:00
/******/ (() => {
2020-09-21 04:39:12 +08:00
/******/ // no baseURI
/******/
2018-12-19 21:05:17 +08:00
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // Promise = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "pageA": 0
/******/ };
/******/
/******/ var deferredModules = [
/******/ [0,"vendor","commons-utility2_js"]
/******/ ];
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
/******/
2020-05-21 05:26:51 +08:00
/******/ // no preloaded
/******/
2018-12-19 21:05:17 +08:00
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
/******/ var checkDeferredModules = x => {};
2018-12-19 21:05:17 +08:00
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
2020-09-21 04:39:12 +08:00
/******/ var [chunkIds, moreModules, runtime, executeModules] = data;
2018-12-19 21:05:17 +08:00
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0, resolves = [];
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
2020-05-21 05:26:51 +08:00
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
2018-12-19 21:05:17 +08:00
/******/ resolves.push(installedChunks[chunkId][0]);
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
2018-12-19 21:05:17 +08:00
/******/ for(moduleId in moreModules) {
2020-05-21 05:26:51 +08:00
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
2018-12-19 21:05:17 +08:00
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
2018-12-19 21:05:17 +08:00
/******/ if(runtime) runtime(__webpack_require__);
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
2018-12-19 21:05:17 +08:00
/******/ while(resolves.length) {
/******/ resolves.shift()();
/******/ }
2018-12-19 21:05:17 +08:00
/******/
/******/ // add entry modules from loaded chunk to deferred list
/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules);
/******/
/******/ // run deferred modules when all chunks ready
/******/ return checkDeferredModules();
2020-09-21 04:39:12 +08:00
/******/ }
2018-12-19 21:05:17 +08:00
/******/
2020-09-21 04:39:12 +08:00
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/
/******/ function checkDeferredModulesImpl() {
/******/ var result;
/******/ for(var i = 0; i < deferredModules.length; i++) {
/******/ var deferredModule = deferredModules[i];
/******/ var fulfilled = true;
/******/ for(var j = 1; j < deferredModule.length; j++) {
/******/ var depId = deferredModule[j];
/******/ if(installedChunks[depId] !== 0) fulfilled = false;
/******/ }
/******/ if(fulfilled) {
/******/ deferredModules.splice(i--, 1);
/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
/******/ }
/******/ }
/******/ if(deferredModules.length === 0) {
/******/ __webpack_require__.x();
/******/ __webpack_require__.x = x => {};
/******/ }
/******/ return result;
/******/ }
/******/ var startup = __webpack_require__.x;
/******/ __webpack_require__.x = () => {
/******/ // reset startup function so it can be called again when more startup code is added
/******/ __webpack_require__.x = startup || (x => {});
/******/ return (checkDeferredModules = checkDeferredModulesImpl)();
/******/ };
2020-05-21 05:26:51 +08:00
/******/ })();
2018-12-19 21:05:17 +08:00
/******/
2019-10-11 05:11:05 +08:00
/************************************************************************/
```
</details>
``` js
2019-10-11 05:11:05 +08:00
/******/ // run startup
/******/ return __webpack_require__.x();
/******/ })()
;
2018-12-19 21:05:17 +08:00
```
# dist/pageB.js
2019-05-10 03:34:28 +08:00
```javascript
2019-10-11 05:11:05 +08:00
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 4:
/*!******************!*\
!*** ./pageB.js ***!
\******************/
2020-05-21 05:26:51 +08:00
/*! unknown exports (runtime-defined) */
/*! runtime requirements: module, __webpack_require__ */
2020-09-21 04:39:12 +08:00
/*! CommonJS bailout: module.exports is used directly at 5:0-14 */
2019-10-11 05:11:05 +08:00
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var vendor2 = __webpack_require__(/*! vendor2 */ 5);
var utility2 = __webpack_require__(/*! ./utility2 */ 3);
var utility3 = __webpack_require__(/*! ./utility3 */ 6);
module.exports = "pageB";
/***/ })
/******/ });
```
<details><summary><code>/* webpack runtime code */</code></summary>
``` js
2019-10-11 05:11:05 +08:00
/************************************************************************/
/******/ // The module cache
2019-10-11 05:11:05 +08:00
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
2019-10-11 05:11:05 +08:00
/******/ if(__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
2019-10-11 05:11:05 +08:00
/******/ var module = __webpack_module_cache__[moduleId] = {
2020-05-21 05:26:51 +08:00
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
2019-10-11 05:11:05 +08:00
/******/
/******/ // Execute the module function
2019-10-11 05:11:05 +08:00
/******/ __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
/******/
/******/ // expose the modules object (__webpack_modules__)
2019-10-11 05:11:05 +08:00
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/******/ // the startup function
/******/ // It's empty as some runtime module handles the default behavior
/******/ __webpack_require__.x = x => {}
/************************************************************************/
2020-05-21 05:26:51 +08:00
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
/******/ })();
/******/
2018-12-19 21:05:17 +08:00
/******/ /* webpack/runtime/jsonp chunk loading */
2020-05-21 05:26:51 +08:00
/******/ (() => {
2020-09-21 04:39:12 +08:00
/******/ // no baseURI
/******/
2018-12-19 21:05:17 +08:00
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // Promise = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "pageB": 0
/******/ };
/******/
/******/ var deferredModules = [
/******/ [4,"vendor","commons-utility2_js","commons-utility3_js"]
/******/ ];
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
/******/
2020-05-21 05:26:51 +08:00
/******/ // no preloaded
/******/
2018-12-19 21:05:17 +08:00
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
/******/ var checkDeferredModules = x => {};
2018-12-19 21:05:17 +08:00
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
2020-09-21 04:39:12 +08:00
/******/ var [chunkIds, moreModules, runtime, executeModules] = data;
2018-12-19 21:05:17 +08:00
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0, resolves = [];
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
2020-05-21 05:26:51 +08:00
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
2018-12-19 21:05:17 +08:00
/******/ resolves.push(installedChunks[chunkId][0]);
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
2018-12-19 21:05:17 +08:00
/******/ for(moduleId in moreModules) {
2020-05-21 05:26:51 +08:00
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
2018-12-19 21:05:17 +08:00
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
2018-12-19 21:05:17 +08:00
/******/ if(runtime) runtime(__webpack_require__);
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
2018-12-19 21:05:17 +08:00
/******/ while(resolves.length) {
/******/ resolves.shift()();
/******/ }
2018-12-19 21:05:17 +08:00
/******/
/******/ // add entry modules from loaded chunk to deferred list
/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules);
/******/
/******/ // run deferred modules when all chunks ready
/******/ return checkDeferredModules();
2020-09-21 04:39:12 +08:00
/******/ }
2018-12-19 21:05:17 +08:00
/******/
2020-09-21 04:39:12 +08:00
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/
/******/ function checkDeferredModulesImpl() {
/******/ var result;
/******/ for(var i = 0; i < deferredModules.length; i++) {
/******/ var deferredModule = deferredModules[i];
/******/ var fulfilled = true;
/******/ for(var j = 1; j < deferredModule.length; j++) {
/******/ var depId = deferredModule[j];
/******/ if(installedChunks[depId] !== 0) fulfilled = false;
/******/ }
/******/ if(fulfilled) {
/******/ deferredModules.splice(i--, 1);
/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
/******/ }
/******/ }
/******/ if(deferredModules.length === 0) {
/******/ __webpack_require__.x();
/******/ __webpack_require__.x = x => {};
/******/ }
/******/ return result;
/******/ }
/******/ var startup = __webpack_require__.x;
/******/ __webpack_require__.x = () => {
/******/ // reset startup function so it can be called again when more startup code is added
/******/ __webpack_require__.x = startup || (x => {});
/******/ return (checkDeferredModules = checkDeferredModulesImpl)();
/******/ };
2020-05-21 05:26:51 +08:00
/******/ })();
2018-12-19 21:05:17 +08:00
/******/
2019-10-11 05:11:05 +08:00
/************************************************************************/
```
</details>
``` js
2019-10-11 05:11:05 +08:00
/******/ // run startup
/******/ return __webpack_require__.x();
/******/ })()
;
2018-12-19 21:05:17 +08:00
```
# dist/pageC.js
2019-05-10 03:34:28 +08:00
```javascript
2019-10-11 05:11:05 +08:00
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 7:
/*!******************!*\
!*** ./pageC.js ***!
\******************/
2020-05-21 05:26:51 +08:00
/*! unknown exports (runtime-defined) */
/*! runtime requirements: module, __webpack_require__ */
2020-09-21 04:39:12 +08:00
/*! CommonJS bailout: module.exports is used directly at 4:0-14 */
2019-10-11 05:11:05 +08:00
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var utility2 = __webpack_require__(/*! ./utility2 */ 3);
var utility3 = __webpack_require__(/*! ./utility3 */ 6);
module.exports = "pageC";
/***/ })
/******/ });
```
<details><summary><code>/* webpack runtime code */</code></summary>
``` js
2019-10-11 05:11:05 +08:00
/************************************************************************/
/******/ // The module cache
2019-10-11 05:11:05 +08:00
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
2019-10-11 05:11:05 +08:00
/******/ if(__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
2019-10-11 05:11:05 +08:00
/******/ var module = __webpack_module_cache__[moduleId] = {
2020-05-21 05:26:51 +08:00
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
2019-10-11 05:11:05 +08:00
/******/
/******/ // Execute the module function
2019-10-11 05:11:05 +08:00
/******/ __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
/******/
/******/ // expose the modules object (__webpack_modules__)
2019-10-11 05:11:05 +08:00
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/******/ // the startup function
/******/ // It's empty as some runtime module handles the default behavior
/******/ __webpack_require__.x = x => {}
/************************************************************************/
2020-05-21 05:26:51 +08:00
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
/******/ })();
/******/
2018-12-19 21:05:17 +08:00
/******/ /* webpack/runtime/jsonp chunk loading */
2020-05-21 05:26:51 +08:00
/******/ (() => {
2020-09-21 04:39:12 +08:00
/******/ // no baseURI
/******/
2018-12-19 21:05:17 +08:00
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // Promise = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "pageC": 0
/******/ };
/******/
/******/ var deferredModules = [
/******/ [7,"commons-utility2_js","commons-utility3_js"]
/******/ ];
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
/******/
2020-05-21 05:26:51 +08:00
/******/ // no preloaded
/******/
2018-12-19 21:05:17 +08:00
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
/******/ var checkDeferredModules = x => {};
2018-12-19 21:05:17 +08:00
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
2020-09-21 04:39:12 +08:00
/******/ var [chunkIds, moreModules, runtime, executeModules] = data;
2018-12-19 21:05:17 +08:00
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0, resolves = [];
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
2020-05-21 05:26:51 +08:00
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
2018-12-19 21:05:17 +08:00
/******/ resolves.push(installedChunks[chunkId][0]);
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/ for(moduleId in moreModules) {
2020-05-21 05:26:51 +08:00
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
2018-12-19 21:05:17 +08:00
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) runtime(__webpack_require__);
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
2018-12-19 21:05:17 +08:00
/******/ while(resolves.length) {
/******/ resolves.shift()();
/******/ }
/******/
/******/ // add entry modules from loaded chunk to deferred list
/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules);
/******/
/******/ // run deferred modules when all chunks ready
/******/ return checkDeferredModules();
2020-09-21 04:39:12 +08:00
/******/ }
2018-12-19 21:05:17 +08:00
/******/
2020-09-21 04:39:12 +08:00
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/
/******/ function checkDeferredModulesImpl() {
/******/ var result;
/******/ for(var i = 0; i < deferredModules.length; i++) {
/******/ var deferredModule = deferredModules[i];
/******/ var fulfilled = true;
/******/ for(var j = 1; j < deferredModule.length; j++) {
/******/ var depId = deferredModule[j];
/******/ if(installedChunks[depId] !== 0) fulfilled = false;
/******/ }
/******/ if(fulfilled) {
/******/ deferredModules.splice(i--, 1);
/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
/******/ }
/******/ }
/******/ if(deferredModules.length === 0) {
/******/ __webpack_require__.x();
/******/ __webpack_require__.x = x => {};
/******/ }
/******/ return result;
/******/ }
/******/ var startup = __webpack_require__.x;
/******/ __webpack_require__.x = () => {
/******/ // reset startup function so it can be called again when more startup code is added
/******/ __webpack_require__.x = startup || (x => {});
/******/ return (checkDeferredModules = checkDeferredModulesImpl)();
/******/ };
2020-05-21 05:26:51 +08:00
/******/ })();
2018-12-19 21:05:17 +08:00
/******/
2019-10-11 05:11:05 +08:00
/************************************************************************/
```
</details>
``` js
2019-10-11 05:11:05 +08:00
/******/ // run startup
/******/ return __webpack_require__.x();
/******/ })()
;
2016-01-04 11:07:08 +08:00
```
# Info
2017-12-14 17:58:03 +08:00
## Unoptimized
2016-01-04 11:07:08 +08:00
```
2020-09-21 04:39:12 +08:00
assets by chunk 768 bytes (id hint: commons)
asset commons-utility2_js.js 384 bytes [emitted] (id hint: commons)
asset commons-utility3_js.js 384 bytes [emitted] (id hint: commons)
asset pageA.js 6 KiB [emitted] (name: pageA)
asset pageB.js 5.73 KiB [emitted] (name: pageB)
asset pageC.js 5.67 KiB [emitted] (name: pageC)
2020-09-21 04:39:12 +08:00
asset vendor.js 737 bytes [emitted] (name: vendor) (id hint: vendor)
Entrypoint pageA 7.09 KiB = vendor.js 737 bytes commons-utility2_js.js 384 bytes pageA.js 6 KiB
Entrypoint pageB 7.2 KiB = vendor.js 737 bytes commons-utility2_js.js 384 bytes commons-utility3_js.js 384 bytes pageB.js 5.73 KiB
Entrypoint pageC 6.42 KiB = commons-utility2_js.js 384 bytes commons-utility3_js.js 384 bytes pageC.js 5.67 KiB
chunk (runtime: pageA, pageB, pageC) commons-utility2_js.js (id hint: commons) 28 bytes [initial] [rendered] split chunk (cache group: commons)
2020-09-21 04:39:12 +08:00
> ./pageA pageA
> ./pageB pageB
> ./pageC pageC
./utility2.js 28 bytes [built] [code generated]
[used exports unknown]
cjs require ./utility2 ./pageA.js 3:15-36
cjs require ./utility2 ./pageB.js 2:15-36
cjs require ./utility2 ./pageC.js 1:15-36
cjs self exports reference ./utility2.js 1:0-14
chunk (runtime: pageB, pageC) commons-utility3_js.js (id hint: commons) 28 bytes [initial] [rendered] split chunk (cache group: commons)
2020-09-21 04:39:12 +08:00
> ./pageB pageB
> ./pageC pageC
./utility3.js 28 bytes [built] [code generated]
[used exports unknown]
cjs require ./utility3 ./pageB.js 3:15-36
cjs require ./utility3 ./pageC.js 2:15-36
cjs self exports reference ./utility3.js 1:0-14
chunk (runtime: pageA) pageA.js (pageA) 165 bytes (javascript) 2.6 KiB (runtime) [entry] [rendered]
2020-09-21 04:39:12 +08:00
> ./pageA pageA
runtime modules 2.6 KiB 2 modules
2020-09-21 04:39:12 +08:00
dependent modules 28 bytes [dependent] 1 module
./pageA.js 137 bytes [built] [code generated]
[used exports unknown]
cjs self exports reference ./pageA.js 5:0-14
entry ./pageA pageA
chunk (runtime: pageB) pageB.js (pageB) 137 bytes (javascript) 2.62 KiB (runtime) [entry] [rendered]
2020-09-21 04:39:12 +08:00
> ./pageB pageB
runtime modules 2.62 KiB 2 modules
2020-09-21 04:39:12 +08:00
./pageB.js 137 bytes [built] [code generated]
[used exports unknown]
cjs self exports reference ./pageB.js 5:0-14
entry ./pageB pageB
chunk (runtime: pageC) pageC.js (pageC) 102 bytes (javascript) 2.61 KiB (runtime) [entry] [rendered]
2020-09-21 04:39:12 +08:00
> ./pageC pageC
runtime modules 2.61 KiB 2 modules
2020-09-21 04:39:12 +08:00
./pageC.js 102 bytes [built] [code generated]
[used exports unknown]
cjs self exports reference ./pageC.js 4:0-14
entry ./pageC pageC
chunk (runtime: pageA, pageB) vendor.js (vendor) (id hint: vendor) 54 bytes [initial] [rendered] split chunk (cache group: vendor) (name: vendor)
2020-09-21 04:39:12 +08:00
> ./pageA pageA
> ./pageB pageB
./node_modules/vendor1.js 27 bytes [built] [code generated]
[used exports unknown]
cjs self exports reference ./node_modules/vendor1.js 1:0-14
cjs require vendor1 ./pageA.js 1:14-32
./node_modules/vendor2.js 27 bytes [built] [code generated]
[used exports unknown]
cjs self exports reference ./node_modules/vendor2.js 1:0-14
cjs require vendor2 ./pageB.js 1:14-32
webpack 5.11.1 compiled successfully
2016-01-04 11:07:08 +08:00
```
2017-12-14 17:58:03 +08:00
## Production mode
2016-01-04 11:07:08 +08:00
```
2020-09-21 04:39:12 +08:00
assets by chunk 212 bytes (id hint: commons)
asset commons-utility2_js.js 106 bytes [emitted] [minimized] (id hint: commons)
asset commons-utility3_js.js 106 bytes [emitted] [minimized] (id hint: commons)
asset pageA.js 907 bytes [emitted] [minimized] (name: pageA)
asset pageB.js 899 bytes [emitted] [minimized] (name: pageB)
asset pageC.js 883 bytes [emitted] [minimized] (name: pageC)
2020-09-21 04:39:12 +08:00
asset vendor.js 121 bytes [emitted] [minimized] (name: vendor) (id hint: vendor)
Entrypoint pageA 1.11 KiB = vendor.js 121 bytes commons-utility2_js.js 106 bytes pageA.js 907 bytes
Entrypoint pageB 1.2 KiB = vendor.js 121 bytes commons-utility2_js.js 106 bytes commons-utility3_js.js 106 bytes pageB.js 899 bytes
Entrypoint pageC 1.07 KiB = commons-utility2_js.js 106 bytes commons-utility3_js.js 106 bytes pageC.js 883 bytes
2020-09-21 04:39:12 +08:00
chunk (runtime: pageA, pageB, pageC) commons-utility2_js.js (id hint: commons) 28 bytes [initial] [rendered] split chunk (cache group: commons)
> ./pageA pageA
> ./pageB pageB
> ./pageC pageC
./utility2.js 28 bytes [built] [code generated]
[used exports unknown]
cjs require ./utility2 ./pageA.js 3:15-36
cjs require ./utility2 ./pageB.js 2:15-36
cjs require ./utility2 ./pageC.js 1:15-36
cjs self exports reference ./utility2.js 1:0-14
chunk (runtime: pageB, pageC) commons-utility3_js.js (id hint: commons) 28 bytes [initial] [rendered] split chunk (cache group: commons)
> ./pageB pageB
> ./pageC pageC
./utility3.js 28 bytes [built] [code generated]
[used exports unknown]
cjs require ./utility3 ./pageB.js 3:15-36
cjs require ./utility3 ./pageC.js 2:15-36
cjs self exports reference ./utility3.js 1:0-14
chunk (runtime: pageA) pageA.js (pageA) 165 bytes (javascript) 2.6 KiB (runtime) [entry] [rendered]
2020-09-21 04:39:12 +08:00
> ./pageA pageA
runtime modules 2.6 KiB 2 modules
2020-09-21 04:39:12 +08:00
dependent modules 28 bytes [dependent] 1 module
./pageA.js 137 bytes [built] [code generated]
[used exports unknown]
cjs self exports reference ./pageA.js 5:0-14
entry ./pageA pageA
chunk (runtime: pageB) pageB.js (pageB) 137 bytes (javascript) 2.63 KiB (runtime) [entry] [rendered]
> ./pageB pageB
runtime modules 2.63 KiB 2 modules
./pageB.js 137 bytes [built] [code generated]
[used exports unknown]
cjs self exports reference ./pageB.js 5:0-14
entry ./pageB pageB
chunk (runtime: pageC) pageC.js (pageC) 102 bytes (javascript) 2.62 KiB (runtime) [entry] [rendered]
> ./pageC pageC
runtime modules 2.62 KiB 2 modules
./pageC.js 102 bytes [built] [code generated]
[used exports unknown]
cjs self exports reference ./pageC.js 4:0-14
entry ./pageC pageC
chunk (runtime: pageA, pageB) vendor.js (vendor) (id hint: vendor) 54 bytes [initial] [rendered] split chunk (cache group: vendor) (name: vendor)
> ./pageA pageA
> ./pageB pageB
./node_modules/vendor1.js 27 bytes [built] [code generated]
[used exports unknown]
cjs self exports reference ./node_modules/vendor1.js 1:0-14
cjs require vendor1 ./pageA.js 1:14-32
./node_modules/vendor2.js 27 bytes [built] [code generated]
[used exports unknown]
cjs self exports reference ./node_modules/vendor2.js 1:0-14
cjs require vendor2 ./pageB.js 1:14-32
webpack 5.11.1 compiled successfully
2016-01-04 11:07:08 +08:00
```