2020-05-21 05:26:51 +08:00
A common challenge with combining `[chunkhash]` and Code Splitting is that the entry chunk includes the webpack runtime and with it the chunkhash mappings. This means it's always updated and the `[chunkhash]` is pretty useless because this chunk won't be cached.
2015-11-21 04:36:43 +08:00
2020-05-21 05:26:51 +08:00
A very simple solution to this problem is to create another chunk that contains only the webpack runtime (including chunkhash map). This can be achieved with `optimization.runtimeChunk` options. To avoid the additional request for another chunk, this pretty small chunk can be inlined into the HTML page.
2015-11-21 04:36:43 +08:00
The configuration required for this is:
2019-04-09 02:29:40 +08:00
- use `[chunkhash]` in `output.filename` (Note that this example doesn't do this because of the example generator infrastructure, but you should)
- use `[chunkhash]` in `output.chunkFilename` (Note that this example doesn't do this because of the example generator infrastructure, but you should)
2015-11-21 04:36:43 +08:00
# example.js
2019-04-09 02:29:40 +08:00
```javascript
2015-11-21 04:36:43 +08:00
// some module
2017-02-13 15:49:35 +08:00
import("./async1");
import("./async2");
2015-11-21 04:36:43 +08:00
```
# webpack.config.js
2019-04-09 02:29:40 +08:00
```javascript
2015-11-21 04:36:43 +08:00
var path = require("path");
module.exports = {
2023-03-12 10:27:40 +08:00
// mode: "development" || "production",
2015-11-21 04:36:43 +08:00
entry: {
2018-01-20 00:06:59 +08:00
main: "./example"
},
optimization: {
runtimeChunk: true
2015-11-21 04:36:43 +08:00
},
output: {
2018-01-05 04:39:29 +08:00
path: path.join(__dirname, "dist"),
2017-04-04 16:48:59 +08:00
filename: "[name].[chunkhash].js",
2018-01-20 00:06:59 +08:00
chunkFilename: "[name].[chunkhash].js"
}
2015-11-21 04:36:43 +08:00
};
```
# index.html
2019-04-09 02:29:40 +08:00
```html
2015-11-21 04:36:43 +08:00
< html >
2019-04-09 02:29:40 +08:00
< head > < / head >
< body >
<!-- inlined minimized file "runtime~main.[chunkhash].js" -->
< script >
2023-04-08 06:23:22 +08:00
(()=>{"use strict";var e,r,t,o,n={},a={};function i(e){var r=a[e];if(void 0!==r)return r.exports;var t=a[e]={exports:{}};return n[e](t,t.exports,i),t.exports}i.m=n,e=[],i.O=(r,t,o,n)=>{if(!t){var a=1/0;for(s=0;s< e.length ; s ++){ for ( var [ t , o , n ]= e [ s ], l = !0,u=0;u<t.length;u++)(!1&n||a > =n)&&Object.keys(i.O).every((e=>i.O[e](t[u])))?t.splice(u--,1):(l=!1,n<a&&(a=n)); if(l){e.splice(s--,1);var f=o();void 0!==f&& (r=f)}}return r}n=n||0;for(var s=e.length;s>0&&e[s-1][2]>n; s--)e[s]=e[s-1];e[s]=[t,o,n]},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(e,o){if(1& o&& (e=this(e)),8& o)return e;if("object"==typeof e&& e){if(4& o&& e.__esModule)return e;if(16& o&& "function"==typeof e.then)return e}var n=Object.create(null);i.r(n);var a={};r=r||[null,t({}),t([]),t(t)];for(var l=2&o&&e; "object"==typeof l&&!~r.indexOf(l); l=t(l))Object.getOwnPropertyNames(l).forEach((r=>a[r]=()=>e[r]));return a.default=()=>e,i.d(n,a),n},i.d=(e,r)=>{for(var t in r)i.o(r,t)&&!i.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((r,t)=>(i.f[t](e,r),r)),[])),i.u=e=>e+".[chunkhash].js",i.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o={},i.l=(e,r,t,n)=>{if(o[e])o[e].push(r); else{var a,l;if(void 0!==t)for(var u=document.getElementsByTagName("script"),f=0;f< u.length ; f ++){ var s = u[f];if(s.getAttribute("src")==e){a=s;break}}a||(l=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=e),o[e]=[r];var c = (r,t)= > {a.onerror=a.onload=null,clearTimeout(d);var n=o[e];if(delete o[e],a.parentNode&& a.parentNode.removeChild(a),n&& n.forEach((e=>e(t))),r)return r(t)},d=setTimeout(c.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=c.bind(null,a.onerror),a.onload=c.bind(null,a.onload),l&& document.head.appendChild(a)}},i.r=e=>{"undefined"!=typeof Symbol&& Symbol.toStringTag&& Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.p="dist/",(()=>{var e={303:0};i.f.j=(r,t)=>{var o=i.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else if(303!=r){var n=new Promise(((t,n)=>o=e[r]=[t,n]));t.push(o[2]=n);var a=i.p+i.u(r),l=new Error;i.l(a,(t=>{if(i.o(e,r)&& (0!==(o=e[r])&& (e[r]=void 0),o)){var n=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src; l.message="Loading chunk "+r+" failed.\n("+n+": "+a+")",l.name="ChunkLoadError",l.type=n,l.request=a,o[1](l)}}),"chunk-"+r,r)}else e[r]=0},i.O.j=r=>0===e[r];var r=(r,t)=>{var o,n,[a,l,u]=t,f=0;if(a.some((r=>0!==e[r]))){for(o in l)i.o(l,o)&&(i.m[o]=l[o]); if(u)var s=u(i)}for(r&&r(t); f< a.length ; f ++) n = a[f],i.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return i . O ( s )}, t = self.webpackChunk=self.webpackChunk||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})()})();
2019-04-09 02:29:40 +08:00
< / script >
2015-11-21 04:36:43 +08:00
2019-04-09 02:29:40 +08:00
< script src = "dist/main.[chunkhash].js" > < / script >
< / body >
2015-11-21 04:36:43 +08:00
< / html >
```
2018-02-10 22:09:46 +08:00
# dist/runtime~main.[chunkhash].js
2015-11-21 04:36:43 +08:00
2019-04-09 02:29:40 +08:00
```javascript
2019-10-11 05:11:05 +08:00
/******/ (() => { // webpackBootstrap
2018-12-19 21:05:17 +08:00
/******/ "use strict";
2019-10-11 05:11:05 +08:00
/******/ var __webpack_modules__ = ({});
2019-11-19 21:10:28 +08:00
```
< details > < summary > < code > /* webpack runtime code */< / code > < / summary >
``` js
2019-10-11 05:11:05 +08:00
/************************************************************************/
2018-01-20 00:06:59 +08:00
/******/ // The module cache
2019-10-11 05:11:05 +08:00
/******/ var __webpack_module_cache__ = {};
/******/
2018-01-20 00:06:59 +08:00
/******/ // The require function
/******/ function __webpack_require__ (moduleId) {
/******/ // Check if module is in cache
2021-08-20 14:12:50 +08:00
/******/ var cachedModule = __webpack_module_cache__ [moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
2018-01-20 00:06:59 +08:00
/******/ }
/******/ // 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
2018-01-20 00:06:59 +08:00
/******/ exports: {}
/******/ };
2019-10-11 05:11:05 +08:00
/******/
2018-01-20 00:06:59 +08:00
/******/ // Execute the module function
2019-10-11 05:11:05 +08:00
/******/ __webpack_modules__ [moduleId ](module, module.exports, __webpack_require__ );
/******/
2018-01-20 00:06:59 +08:00
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
2019-10-11 05:11:05 +08:00
/******/
2018-12-19 21:05:17 +08:00
/******/ // expose the modules object (__webpack_modules__)
2019-10-11 05:11:05 +08:00
/******/ __webpack_require__ .m = __webpack_modules__ ;
/******/
2018-12-19 21:05:17 +08:00
/************************************************************************/
2021-08-20 14:12:50 +08:00
/******/ /* webpack/runtime/chunk loaded */
/******/ (() => {
/******/ var deferred = [];
/******/ __webpack_require__ .O = (result, chunkIds, fn, priority) => {
/******/ if(chunkIds) {
/******/ priority = priority || 0;
/******/ for(var i = deferred.length; i > 0 & & deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
/******/ deferred[i] = [chunkIds, fn, priority];
/******/ return;
/******/ }
/******/ var notFulfilled = Infinity;
/******/ for (var i = 0; i < deferred.length ; i + + ) {
/******/ var [chunkIds, fn, priority] = deferred[i];
/******/ var fulfilled = true;
/******/ for (var j = 0; j < chunkIds.length ; j + + ) {
/******/ if ((priority & 1 === 0 || notFulfilled >= priority) & & Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
/******/ chunkIds.splice(j--, 1);
/******/ } else {
/******/ fulfilled = false;
/******/ if(priority < notFulfilled ) notFulfilled = priority;
/******/ }
/******/ }
/******/ if(fulfilled) {
/******/ deferred.splice(i--, 1)
/******/ var r = fn();
/******/ if (r !== undefined) result = r;
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/ })();
/******/
2018-12-19 21:05:17 +08:00
/******/ /* webpack/runtime/create fake namespace object */
2020-05-21 05:26:51 +08:00
/******/ (() => {
2021-08-20 14:12:50 +08:00
/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
2020-12-11 17:29:32 +08:00
/******/ var leafPrototypes;
2018-12-19 21:05:17 +08:00
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
2020-12-11 17:29:32 +08:00
/******/ // mode & 16: return value when it's Promise-like
2018-12-19 21:05:17 +08:00
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__ .t = function(value, mode) {
/******/ if(mode & 1) value = this(value);
/******/ if(mode & 8) return value;
2020-12-11 17:29:32 +08:00
/******/ if(typeof value === 'object' & & value) {
/******/ if((mode & 4) & & value.__esModule) return value;
/******/ if((mode & 16) & & typeof value.then === 'function') return value;
/******/ }
2018-12-19 21:05:17 +08:00
/******/ var ns = Object.create(null);
/******/ __webpack_require__ .r(ns);
2019-11-15 07:06:30 +08:00
/******/ var def = {};
2020-12-11 17:29:32 +08:00
/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
/******/ for(var current = mode & 2 & & value; typeof current == 'object' & & !~leafPrototypes.indexOf(current); current = getProto(current)) {
2021-08-20 14:12:50 +08:00
/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
2019-10-09 05:45:47 +08:00
/******/ }
2021-08-20 14:12:50 +08:00
/******/ def['default'] = () => (value);
2019-11-15 07:06:30 +08:00
/******/ __webpack_require__ .d(ns, def);
2018-12-19 21:05:17 +08:00
/******/ return ns;
/******/ };
2020-05-21 05:26:51 +08:00
/******/ })();
2018-12-19 21:05:17 +08:00
/******/
2019-10-09 05:45:47 +08:00
/******/ /* webpack/runtime/define property getters */
2020-05-21 05:26:51 +08:00
/******/ (() => {
2019-10-09 05:45:47 +08:00
/******/ // define getter functions for harmony exports
/******/ __webpack_require__ .d = (exports, definition) => {
/******/ for(var key in definition) {
2020-05-21 05:26:51 +08:00
/******/ if(__webpack_require__.o(definition, key) & & !__webpack_require__.o(exports, key)) {
2019-10-09 05:45:47 +08:00
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
2018-12-19 21:05:17 +08:00
/******/ }
/******/ };
2020-05-21 05:26:51 +08:00
/******/ })();
2018-12-19 21:05:17 +08:00
/******/
2019-11-15 07:06:30 +08:00
/******/ /* webpack/runtime/ensure chunk */
2020-05-21 05:26:51 +08:00
/******/ (() => {
2019-11-15 07:06:30 +08:00
/******/ __webpack_require__ .f = {};
/******/ // This file contains only the entry chunk.
/******/ // The chunk loading function for additional chunks
/******/ __webpack_require__ .e = (chunkId) => {
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
/******/ __webpack_require__ .f[key](chunkId, promises);
/******/ return promises;
/******/ }, []));
/******/ };
2020-05-21 05:26:51 +08:00
/******/ })();
2019-11-15 07:06:30 +08:00
/******/
/******/ /* webpack/runtime/get javascript chunk filename */
2020-05-21 05:26:51 +08:00
/******/ (() => {
2019-11-15 07:06:30 +08:00
/******/ // This function allow to reference async chunks
/******/ __webpack_require__ .u = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return "" + chunkId + ".[chunkhash].js";
/******/ };
2020-05-21 05:26:51 +08:00
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
2021-08-20 14:12:50 +08:00
/******/ __webpack_require__ .o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
2020-05-21 05:26:51 +08:00
/******/ })();
2019-11-15 07:06:30 +08:00
/******/
2020-09-21 04:39:12 +08:00
/******/ /* webpack/runtime/load script */
/******/ (() => {
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
2021-08-20 14:12:50 +08:00
/******/ __webpack_require__ .l = (url, done, key, chunkId) => {
2020-09-21 04:39:12 +08:00
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
/******/ var scripts = document.getElementsByTagName("script");
/******/ for(var i = 0; i < script s . length ; i + + ) {
/******/ var s = scripts[i];
/******/ if(s.getAttribute("src") == url) { script = s; break; }
/******/ }
/******/ }
/******/ if(!script) {
/******/ needAttach = true;
/******/ script = document.createElement('script');
/******/
/******/ script.charset = 'utf-8';
/******/ script.timeout = 120;
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__ .nc);
/******/ }
/******/
/******/ script.src = url;
/******/ }
/******/ inProgress[url] = [done];
/******/ var onScriptComplete = (prev, event) => {
/******/ // avoid mem leaks in IE.
/******/ script.onerror = script.onload = null;
/******/ clearTimeout(timeout);
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode & & script.parentNode.removeChild(script);
2021-08-20 14:12:50 +08:00
/******/ doneFns & & doneFns.forEach((fn) => (fn(event)));
2020-09-21 04:39:12 +08:00
/******/ if(prev) return prev(event);
/******/ }
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
/******/ needAttach & & document.head.appendChild(script);
/******/ };
/******/ })();
/******/
2018-12-19 21:05:17 +08:00
/******/ /* webpack/runtime/make namespace object */
2020-05-21 05:26:51 +08:00
/******/ (() => {
2018-12-19 21:05:17 +08:00
/******/ // define __esModule on exports
2019-10-09 05:45:47 +08:00
/******/ __webpack_require__ .r = (exports) => {
2018-12-19 21:05:17 +08:00
/******/ if(typeof Symbol !== 'undefined' & & Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
2020-05-21 05:26:51 +08:00
/******/ })();
2018-12-19 21:05:17 +08:00
/******/
/******/ /* webpack/runtime/publicPath */
2020-05-21 05:26:51 +08:00
/******/ (() => {
2018-12-19 21:05:17 +08:00
/******/ __webpack_require__ .p = "dist/";
2020-05-21 05:26:51 +08:00
/******/ })();
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
2021-08-20 14:12:50 +08:00
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
2018-12-19 21:05:17 +08:00
/******/ var installedChunks = {
2020-09-21 04:39:12 +08:00
/******/ 1: 0
2018-12-19 21:05:17 +08:00
/******/ };
/******/
2019-10-09 05:45:47 +08:00
/******/ __webpack_require__ .f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
2020-05-21 05:26:51 +08:00
/******/ var installedChunkData = __webpack_require__ .o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
2019-10-09 05:45:47 +08:00
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
2018-12-19 21:05:17 +08:00
/******/
2019-10-09 05:45:47 +08:00
/******/ // a Promise means "currently loading".
/******/ if(installedChunkData) {
/******/ promises.push(installedChunkData[2]);
/******/ } else {
2021-08-20 14:12:50 +08:00
/******/ if(1 != chunkId) {
2019-10-09 05:45:47 +08:00
/******/ // setup Promise in chunk cache
2021-08-20 14:12:50 +08:00
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
2019-10-09 05:45:47 +08:00
/******/ promises.push(installedChunkData[2] = promise);
2018-12-19 21:05:17 +08:00
/******/
2019-10-09 05:45:47 +08:00
/******/ // start chunk loading
/******/ var url = __webpack_require__ .p + __webpack_require__ .u(chunkId);
2020-09-21 04:39:12 +08:00
/******/ // create error before stack unwound to get useful stacktrace later
/******/ var error = new Error();
/******/ var loadingEnded = (event) => {
2020-05-21 05:26:51 +08:00
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
2019-11-15 07:06:30 +08:00
/******/ installedChunkData = installedChunks[chunkId];
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
2020-09-21 04:39:12 +08:00
/******/ if(installedChunkData) {
/******/ var errorType = event & & (event.type === 'load' ? 'missing' : event.type);
/******/ var realSrc = event & & event.target & & event.target.src;
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
/******/ error.name = 'ChunkLoadError';
/******/ error.type = errorType;
/******/ error.request = realSrc;
/******/ installedChunkData[1](error);
/******/ }
2019-11-15 07:06:30 +08:00
/******/ }
2019-10-09 05:45:47 +08:00
/******/ };
2021-08-20 14:12:50 +08:00
/******/ __webpack_require__ .l(url, loadingEnded, "chunk-" + chunkId, chunkId);
2019-10-09 05:45:47 +08:00
/******/ } else installedChunks[chunkId] = 0;
/******/ }
2018-12-19 21:05:17 +08:00
/******/ }
/******/ };
/******/
/******/ // 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
/******/
2021-08-20 14:12:50 +08:00
/******/ __webpack_require__ .O.j = (chunkId) => (installedChunks[chunkId] === 0);
2018-12-19 21:05:17 +08:00
/******/
/******/ // install a JSONP callback for chunk loading
2020-12-11 17:29:32 +08:00
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
2021-08-20 14:12:50 +08:00
/******/ var [chunkIds, moreModules, runtime] = data;
2018-12-19 21:05:17 +08:00
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
2021-08-20 14:12:50 +08:00
/******/ var moduleId, chunkId, i = 0;
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
/******/ for(moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__ .m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) var result = runtime(__webpack_require__);
/******/ }
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
2018-12-19 21:05:17 +08:00
/******/ for(;i < chunkIds.length ; i + + ) {
/******/ chunkId = chunkIds[i];
2020-05-21 05:26:51 +08:00
/******/ if(__webpack_require__.o(installedChunks, chunkId) & & installedChunks[chunkId]) {
2021-08-20 14:12:50 +08:00
/******/ installedChunks[chunkId][0]();
2018-12-19 21:05:17 +08:00
/******/ }
2023-04-08 06:23:22 +08:00
/******/ installedChunks[chunkId] = 0;
2018-12-19 21:05:17 +08:00
/******/ }
2021-08-20 14:12:50 +08:00
/******/ return __webpack_require__ .O(result);
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"] || [];
2020-12-11 17:29:32 +08:00
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
2020-05-21 05:26:51 +08:00
/******/ })();
2018-12-19 21:05:17 +08:00
/******/
2019-10-11 05:11:05 +08:00
/************************************************************************/
2019-11-19 21:10:28 +08:00
```
< / details >
``` js
2021-08-20 14:12:50 +08:00
/******/
/******/
2019-10-11 05:11:05 +08:00
/******/ })()
;
2018-01-20 00:06:59 +08:00
```
2015-11-21 04:36:43 +08:00
2018-01-05 04:39:29 +08:00
# dist/main.[chunkhash].js
2015-11-21 04:36:43 +08:00
2019-04-09 02:29:40 +08:00
```javascript
2020-09-21 04:39:12 +08:00
(self["webpackChunk"] = self["webpackChunk"] || []).push([[0],[
2017-12-14 17:58:03 +08:00
/* 0 */
2015-11-21 04:36:43 +08:00
/*!********************!*\
!*** ./example.js ** *!
\********************/
2020-05-21 05:26:51 +08:00
/*! unknown exports (runtime-defined) */
2019-10-11 05:11:05 +08:00
/*! runtime requirements: __webpack_require__ .e, __webpack_require__ .t, __webpack_require__ .* */
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__ ) => {
2015-11-21 04:36:43 +08:00
2016-09-07 18:28:56 +08:00
// some module
2020-12-11 17:29:32 +08:00
__webpack_require__.e(/*! import() */ 2).then(__webpack_require__.t.bind(__webpack_require__, /* ! ./async1 */ 1, 23));
__webpack_require__.e(/*! import() */ 3).then(__webpack_require__.t.bind(__webpack_require__, /* ! ./async2 */ 2, 23));
2015-11-21 04:36:43 +08:00
2017-02-13 15:49:35 +08:00
/***/ })
2020-09-21 04:39:12 +08:00
],
2021-08-20 14:12:50 +08:00
/******/ __webpack_require__ => { // webpackRuntimeModules
/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
/******/ var __webpack_exports__ = (__webpack_exec__(0));
/******/ }
]);
2015-11-21 04:36:43 +08:00
```
# Info
2017-12-14 17:58:03 +08:00
## Unoptimized
2015-11-21 04:36:43 +08:00
```
2021-08-20 14:12:50 +08:00
asset runtime~main.[chunkhash].js 12.2 KiB [emitted] (name: runtime~main)
asset main.[chunkhash].js 873 bytes [emitted] (name: main)
2020-09-21 04:39:12 +08:00
asset 2.[chunkhash].js 285 bytes [emitted]
asset 3.[chunkhash].js 279 bytes [emitted]
2021-08-20 14:12:50 +08:00
Entrypoint main 13 KiB = runtime~main.[chunkhash].js 12.2 KiB main.[chunkhash].js 873 bytes
2020-12-11 17:29:32 +08:00
chunk (runtime: runtime~main) main.[chunkhash].js (main) 55 bytes [initial] [rendered]
2020-09-21 04:39:12 +08:00
> ./example main
./example.js 55 bytes [built] [code generated]
[used exports unknown]
entry ./example main
2023-04-08 06:23:22 +08:00
chunk (runtime: runtime~main) runtime~main.[chunkhash].js (runtime~main) 7.59 KiB [entry] [rendered]
2020-09-21 04:39:12 +08:00
> ./example main
2023-04-08 06:23:22 +08:00
runtime modules 7.59 KiB 10 modules
2020-12-11 17:29:32 +08:00
chunk (runtime: runtime~main) 2.[chunkhash].js 28 bytes [rendered]
2020-09-21 04:39:12 +08:00
> ./async1 ./example.js 2:0-18
./async1.js 28 bytes [built] [code generated]
[used exports unknown]
import() ./async1 ./example.js 2:0-18
2020-12-11 17:29:32 +08:00
chunk (runtime: runtime~main) 3.[chunkhash].js 28 bytes [rendered]
2020-09-21 04:39:12 +08:00
> ./async2 ./example.js 3:0-18
./async2.js 28 bytes [built] [code generated]
[used exports unknown]
import() ./async2 ./example.js 3:0-18
2023-04-08 06:23:22 +08:00
webpack 5.78.0 compiled successfully
2015-11-21 04:36:43 +08:00
```
2017-12-14 17:58:03 +08:00
## Production mode
2015-11-21 04:36:43 +08:00
```
2021-08-20 14:12:50 +08:00
asset runtime~main.[chunkhash].js 2.73 KiB [emitted] [minimized] (name: runtime~main)
asset main.[chunkhash].js 157 bytes [emitted] [minimized] (name: main)
2020-09-21 04:39:12 +08:00
asset 114.[chunkhash].js 69 bytes [emitted] [minimized]
asset 172.[chunkhash].js 69 bytes [emitted] [minimized]
2023-04-08 06:23:22 +08:00
Entrypoint main 2.88 KiB = runtime~main.[chunkhash].js 2.73 KiB main.[chunkhash].js 157 bytes
2020-09-21 04:39:12 +08:00
chunk (runtime: runtime~main) 114.[chunkhash].js 28 bytes [rendered]
> ./async1 ./example.js 2:0-18
./async1.js 28 bytes [built] [code generated]
[used exports unknown]
import() ./async1 ./example.js 2:0-18
chunk (runtime: runtime~main) 172.[chunkhash].js 28 bytes [rendered]
> ./async2 ./example.js 3:0-18
./async2.js 28 bytes [built] [code generated]
[used exports unknown]
import() ./async2 ./example.js 3:0-18
chunk (runtime: runtime~main) main.[chunkhash].js (main) 55 bytes [initial] [rendered]
> ./example main
./example.js 55 bytes [built] [code generated]
[no exports used]
entry ./example main
2023-04-08 06:23:22 +08:00
chunk (runtime: runtime~main) runtime~main.[chunkhash].js (runtime~main) 7.59 KiB [entry] [rendered]
2020-09-21 04:39:12 +08:00
> ./example main
2023-04-08 06:23:22 +08:00
runtime modules 7.59 KiB 10 modules
webpack 5.78.0 compiled successfully
2017-12-14 17:58:03 +08:00
```