|
| 1 | + |
| 2 | +# example.js |
| 3 | + |
| 4 | +``` javascript |
| 5 | +import { increment as inc } from './increment'; |
| 6 | +var a = 1; |
| 7 | +inc(a); // 2 |
| 8 | +``` |
| 9 | + |
| 10 | +# increment.js |
| 11 | + |
| 12 | +``` javascript |
| 13 | +import { add } from './math'; |
| 14 | +export function increment(val) { |
| 15 | + return add(val, 1); |
| 16 | +}; |
| 17 | +``` |
| 18 | + |
| 19 | +# js/output.js |
| 20 | + |
| 21 | +``` javascript |
| 22 | +/******/ (function(modules) { // webpackBootstrap |
| 23 | +/******/ // The module cache |
| 24 | +/******/ var installedModules = {}; |
| 25 | +/******/ |
| 26 | +/******/ // The require function |
| 27 | +/******/ function __webpack_require__(moduleId) { |
| 28 | +/******/ |
| 29 | +/******/ // Check if module is in cache |
| 30 | +/******/ if(installedModules[moduleId]) |
| 31 | +/******/ return installedModules[moduleId].exports; |
| 32 | +/******/ |
| 33 | +/******/ // Create a new module (and put it into the cache) |
| 34 | +/******/ var module = installedModules[moduleId] = { |
| 35 | +/******/ exports: {}, |
| 36 | +/******/ id: moduleId, |
| 37 | +/******/ loaded: false |
| 38 | +/******/ }; |
| 39 | +/******/ |
| 40 | +/******/ // Execute the module function |
| 41 | +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
| 42 | +/******/ |
| 43 | +/******/ // Flag the module as loaded |
| 44 | +/******/ module.loaded = true; |
| 45 | +/******/ |
| 46 | +/******/ // Return the exports of the module |
| 47 | +/******/ return module.exports; |
| 48 | +/******/ } |
| 49 | +/******/ |
| 50 | +/******/ |
| 51 | +/******/ // expose the modules object (__webpack_modules__) |
| 52 | +/******/ __webpack_require__.m = modules; |
| 53 | +/******/ |
| 54 | +/******/ // expose the module cache |
| 55 | +/******/ __webpack_require__.c = installedModules; |
| 56 | +/******/ |
| 57 | +/******/ // __webpack_public_path__ |
| 58 | +/******/ __webpack_require__.p = "js/"; |
| 59 | +/******/ |
| 60 | +/******/ // Load entry module and return exports |
| 61 | +/******/ return __webpack_require__(0); |
| 62 | +/******/ }) |
| 63 | +/************************************************************************/ |
| 64 | +/******/ ([ |
| 65 | +/* 0 */ |
| 66 | +/*!********************!*\ |
| 67 | + !*** ./example.js ***! |
| 68 | + \********************/ |
| 69 | +/***/ function(module, exports, __webpack_require__) { |
| 70 | + |
| 71 | + /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__increment__ = __webpack_require__(/*! ./increment */ 1); |
| 72 | + var a = 1; |
| 73 | + /* harmony import */ __WEBPACK_IMPORTED_MODULE_0__increment__["increment"](a); // 2 |
| 74 | + |
| 75 | +/***/ }, |
| 76 | +/* 1 */ |
| 77 | +/*!**********************!*\ |
| 78 | + !*** ./increment.js ***! |
| 79 | + \**********************/ |
| 80 | +/***/ function(module, exports, __webpack_require__) { |
| 81 | + |
| 82 | + /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__math__ = __webpack_require__(/*! ./math */ 2); |
| 83 | + /* harmony export declaration */function increment(val) { |
| 84 | + return /* harmony import */ __WEBPACK_IMPORTED_MODULE_0__math__["add"](val, 1); |
| 85 | + }/* harmony export */ Object.defineProperty(exports, "increment", {configurable: false, enumerable: true, get: function() { return increment; }});; |
| 86 | + |
| 87 | + |
| 88 | +/***/ }, |
| 89 | +/* 2 */ |
| 90 | +/*!*****************!*\ |
| 91 | + !*** ./math.js ***! |
| 92 | + \*****************/ |
| 93 | +/***/ function(module, exports, __webpack_require__) { |
| 94 | + |
| 95 | + /* harmony export declaration */function add() { |
| 96 | + var sum = 0, i = 0, args = arguments, l = args.length; |
| 97 | + while (i < l) { |
| 98 | + sum += args[i++]; |
| 99 | + } |
| 100 | + return sum; |
| 101 | + }/* harmony export */ Object.defineProperty(exports, "add", {configurable: false, enumerable: true, get: function() { return add; }}); |
| 102 | + |
| 103 | + |
| 104 | +/***/ } |
| 105 | +/******/ ]) |
| 106 | +``` |
| 107 | + |
| 108 | +# Info |
| 109 | + |
| 110 | +## Uncompressed |
| 111 | + |
| 112 | +``` |
| 113 | +Hash: 2cddb2c302ef93d23ea9 |
| 114 | +Version: webpack 1.4.15 |
| 115 | +Time: 47ms |
| 116 | + Asset Size Chunks Chunk Names |
| 117 | +output.js 2792 0 [emitted] main |
| 118 | +chunk {0} output.js (main) 309 [rendered] |
| 119 | + > main [0] ./example.js |
| 120 | + [0] ./example.js 73 {0} [built] |
| 121 | + [1] ./increment.js 94 {0} [built] |
| 122 | + harmony import ./increment [0] ./example.js 1:0-47 |
| 123 | + [2] ./math.js 142 {0} [built] |
| 124 | + harmony import ./math [1] ./increment.js 1:0-29 |
| 125 | +``` |
| 126 | + |
| 127 | +## Minimized (uglify-js, no zip) |
| 128 | + |
| 129 | +``` |
| 130 | +Hash: 810b804d71afd4672772 |
| 131 | +Version: webpack 1.4.15 |
| 132 | +Time: 141ms |
| 133 | + Asset Size Chunks Chunk Names |
| 134 | +output.js 585 0 [emitted] main |
| 135 | +chunk {0} output.js (main) 309 [rendered] |
| 136 | + > main [0] ./example.js |
| 137 | + [0] ./example.js 73 {0} [built] |
| 138 | + [1] ./increment.js 94 {0} [built] |
| 139 | + harmony import ./increment [0] ./example.js 1:0-47 |
| 140 | + [2] ./math.js 142 {0} [built] |
| 141 | + harmony import ./math [1] ./increment.js 1:0-29 |
| 142 | +``` |
0 commit comments