3.0 KiB
3.0 KiB
example.js
var inc = require('./increment').increment;
var a = 1;
inc(a); // 2
increment.js
var add = require('./math').add;
exports.increment = function(val) {
return add(val, 1);
};
math.js
exports.add = function() {
var sum = 0, i = 0, args = arguments, l = args.length;
while (i < l) {
sum += args[i++];
}
return sum;
};
js/output.js
(function(modules) { // webpackBootstrap
// The module cache
var installedModules = {};
// The require function
function require(moduleId) {
// Check if module is in cache
if(installedModules[moduleId])
return installedModules[moduleId].exports;
// Create a new module (and put it into the cache)
var module = installedModules[moduleId] = {
exports: {},
id: moduleId,
loaded: false
};
// Execute the module function
modules[moduleId].call(null, module, module.exports, require);
// Flag the module as loaded
module.loaded = true;
// Return the exports of the module
return module.exports;
}
require.e = function requireEnsure(_, callback) {
callback.call(null, require);
};
require.modules = modules;
require.cache = installedModules;
// Load entry module and return exports
return require(0);
})
/************************************************************************/
({
// __webpack_public_path__
c: "",
/***/ 0:
/*!********************!*\
!*** ./example.js ***!
\********************/
/***/ function(module, exports, require) {
var inc = require(/*! ./increment */ 1).increment;
var a = 1;
inc(a); // 2
/***/ },
/***/ 1:
/*!**********************!*\
!*** ./increment.js ***!
\**********************/
/***/ function(module, exports, require) {
var add = require(/*! ./math */ 2).add;
exports.increment = function(val) {
return add(val, 1);
};
/***/ },
/***/ 2:
/*!*****************!*\
!*** ./math.js ***!
\*****************/
/***/ function(module, exports, require) {
exports.add = function() {
var sum = 0, i = 0, args = arguments, l = args.length;
while (i < l) {
sum += args[i++];
}
return sum;
};
/***/ }
})
Info
Uncompressed
Hash: b3372208595e483f54eaa29577bc99f8
Version: webpack 0.10.0-beta1
Time: 33ms
Asset Size Chunks Chunk Names
output.js 1708 0 main
chunk {0} output.js (main) 329
[0] ./example.js 69 [built] {0}
[1] ./increment.js 98 [built] {0}
cjs require ./increment [0] ./example.js 1:10-32
[2] ./math.js 162 [built] {0}
cjs require ./math [1] ./increment.js 1:10-27
Minimized (uglify-js, no zip)
Hash: b3372208595e483f54eaa29577bc99f8
Version: webpack 0.10.0-beta1
Time: 96ms
Asset Size Chunks Chunk Names
output.js 460 0 main
chunk {0} output.js (main) 329
[0] ./example.js 69 [built] {0}
[1] ./increment.js 98 [built] {0}
cjs require ./increment [0] ./example.js 1:10-32
[2] ./math.js 162 [built] {0}
cjs require ./math [1] ./increment.js 1:10-27