added hybrid-routing example, updated examples

This commit is contained in:
Tobias Koppers 2014-02-03 18:20:55 +01:00
parent e8206d092b
commit aee139ba55
31 changed files with 826 additions and 234 deletions

View File

@ -15,6 +15,8 @@ require(["../dedupe/b"]);
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -30,7 +32,7 @@ require(["../dedupe/b"]);
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -40,13 +42,13 @@ require(["../dedupe/b"]);
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // This file contains only the entry chunk.
@ -357,10 +359,10 @@ webpackJsonp([4],[
```
Hash: 77ef390609ebb4d64a0c
Version: webpack 1.0.0-beta8
Time: 100ms
Version: webpack 1.0.0-rc1
Time: 102ms
Asset Size Chunks Chunk Names
output.js 5041 0 [emitted] main
output.js 5124 0 [emitted] main
1.output.js 1464 1, 3 [emitted]
2.output.js 902 2, 4 [emitted]
3.output.js 873 3 [emitted]
@ -424,10 +426,10 @@ chunk {4} 4.output.js 167 {1} [rendered]
```
Hash: 19041a7eb5dca6ef83d5
Version: webpack 1.0.0-beta8
Time: 268ms
Version: webpack 1.0.0-rc1
Time: 245ms
Asset Size Chunks Chunk Names
output.js 1158 0 [emitted] main
output.js 1150 0 [emitted] main
1.output.js 286 1, 3 [emitted]
2.output.js 206 2, 4 [emitted]
3.output.js 201 3 [emitted]

View File

@ -18,6 +18,8 @@ getTemplate("b", function(b) {
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -33,7 +35,7 @@ getTemplate("b", function(b) {
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -43,13 +45,13 @@ getTemplate("b", function(b) {
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // This file contains only the entry chunk.
@ -204,10 +206,10 @@ webpackJsonp([1],[
```
Hash: f7f9035da2cc820ac9d3
Version: webpack 1.0.0-beta8
Time: 77ms
Version: webpack 1.0.0-rc1
Time: 70ms
Asset Size Chunks Chunk Names
output.js 3908 0 [emitted] main
output.js 3991 0 [emitted] main
1.output.js 1593 1 [emitted]
chunk {0} output.js (main) 261 [rendered]
> main [0] ./example.js
@ -231,10 +233,10 @@ chunk {1} 1.output.js 463 {0} [rendered]
```
Hash: f5f1118ea490c1df2ba7
Version: webpack 1.0.0-beta8
Time: 177ms
Version: webpack 1.0.0-rc1
Time: 175ms
Asset Size Chunks Chunk Names
output.js 838 0 [emitted] main
output.js 830 0 [emitted] main
1.output.js 528 1 [emitted]
chunk {0} output.js (main) 261 [rendered]
> main [0] ./example.js

View File

@ -18,6 +18,8 @@ getTemplate("b", function(b) {
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -33,7 +35,7 @@ getTemplate("b", function(b) {
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -43,13 +45,13 @@ getTemplate("b", function(b) {
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // This file contains only the entry chunk.
@ -204,10 +206,10 @@ webpackJsonp([1],[
```
Hash: 7548e3b0166c8c95d587
Version: webpack 1.0.0-beta8
Time: 83ms
Version: webpack 1.0.0-rc1
Time: 76ms
Asset Size Chunks Chunk Names
output.js 3796 0 [emitted] main
output.js 3879 0 [emitted] main
1.output.js 1593 1 [emitted]
chunk {0} output.js (main) 276 [rendered]
> main [0] ./example.js
@ -231,10 +233,10 @@ chunk {1} 1.output.js 463 {0} [rendered]
```
Hash: 8f939da6680c76bca24d
Version: webpack 1.0.0-beta8
Time: 184ms
Version: webpack 1.0.0-rc1
Time: 177ms
Asset Size Chunks Chunk Names
output.js 799 0 [emitted] main
output.js 791 0 [emitted] main
1.output.js 528 1 [emitted]
chunk {0} output.js (main) 276 [rendered]
> main [0] ./example.js

View File

@ -17,6 +17,8 @@ module.exports = "It works";
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -32,7 +34,7 @@ module.exports = "It works";
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -42,13 +44,13 @@ module.exports = "It works";
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // This file contains only the entry chunk.
@ -166,10 +168,10 @@ webpackJsonp([1],[
```
Hash: b48eaa219fe67eefd271
Version: webpack 1.0.0-beta8
Time: 83ms
Version: webpack 1.0.0-rc1
Time: 86ms
Asset Size Chunks Chunk Names
output.js 4114 0 [emitted] main
output.js 4197 0 [emitted] main
1.output.js 189 1 [emitted]
chunk {0} output.js (main) 458 [rendered]
> main [0] ./example.js
@ -186,10 +188,10 @@ chunk {1} 1.output.js 28 {0} [rendered]
```
Hash: 64de800a2a6968acaf66
Version: webpack 1.0.0-beta8
Time: 197ms
Version: webpack 1.0.0-rc1
Time: 174ms
Asset Size Chunks Chunk Names
output.js 859 0 [emitted] main
output.js 851 0 [emitted] main
1.output.js 55 1 [emitted]
chunk {0} output.js (main) 458 [rendered]
> main [0] ./example.js

View File

@ -14,6 +14,8 @@ require.ensure(["c"], function(require) {
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -29,7 +31,7 @@ require.ensure(["c"], function(require) {
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -39,13 +41,13 @@ require.ensure(["c"], function(require) {
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // This file contains only the entry chunk.
@ -178,10 +180,10 @@ webpackJsonp([1],[,,,function(){},function(){}]);
```
Hash: 51eb9c135b6c6fe4e444
Version: webpack 1.0.0-beta8
Time: 82ms
Version: webpack 1.0.0-rc1
Time: 69ms
Asset Size Chunks Chunk Names
output.js 3952 0 [emitted] main
output.js 4035 0 [emitted] main
1.output.js 327 1 [emitted]
chunk {0} output.js (main) 166 [rendered]
> main [0] ./example.js
@ -203,10 +205,10 @@ chunk {1} 1.output.js 22 {0} [rendered]
```
Hash: 0b0f0366fa1aab3ebbc4
Version: webpack 1.0.0-beta8
Time: 172ms
Version: webpack 1.0.0-rc1
Time: 161ms
Asset Size Chunks Chunk Names
output.js 747 0 [emitted] main
output.js 739 0 [emitted] main
1.output.js 49 1 [emitted]
chunk {0} output.js (main) 166 [rendered]
> main [0] ./example.js

View File

@ -27,6 +27,8 @@ module.exports = 42
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -35,7 +37,7 @@ module.exports = 42
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -45,19 +47,15 @@ module.exports = 42
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // The bundle contains no chunks. A empty chunk loading function.
/******/ require.e = function requireEnsure(_, callback) {
/******/ callback.call(null, this);
/******/ };
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ require.modules = modules;
@ -119,10 +117,10 @@ module.exports = 42
```
Hash: c0e41294caebebf740e1
Version: webpack 1.0.0-beta8
Time: 169ms
Version: webpack 1.0.0-rc1
Time: 158ms
Asset Size Chunks Chunk Names
output.js 2247 0 [emitted] main
output.js 2143 0 [emitted] main
chunk {0} output.js (main) 206 [rendered]
> main [0] ./example.js
[0] ./example.js 31 {0} [built]
@ -137,10 +135,10 @@ chunk {0} output.js (main) 206 [rendered]
```
Hash: 5aad8c5ad018219d8bf0
Version: webpack 1.0.0-beta8
Time: 213ms
Version: webpack 1.0.0-rc1
Time: 207ms
Asset Size Chunks Chunk Names
output.js 424 0 [emitted] main
output.js 379 0 [emitted] main
chunk {0} output.js (main) 206 [rendered]
> main [0] ./example.js
[0] ./example.js 31 {0} [built]

View File

@ -32,6 +32,8 @@ exports.add = function() {
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -40,7 +42,7 @@ exports.add = function() {
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -50,19 +52,15 @@ exports.add = function() {
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // The bundle contains no chunks. A empty chunk loading function.
/******/ require.e = function requireEnsure(_, callback) {
/******/ callback.call(null, this);
/******/ };
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ require.modules = modules;
@ -126,10 +124,10 @@ exports.add = function() {
```
Hash: 463200a36258bb3ff5b2
Version: webpack 1.0.0-beta8
Time: 60ms
Version: webpack 1.0.0-rc1
Time: 57ms
Asset Size Chunks Chunk Names
output.js 2359 0 [emitted] main
output.js 2255 0 [emitted] main
chunk {0} output.js (main) 329 [rendered]
> main [0] ./example.js
[0] ./example.js 69 {0} [built]
@ -143,10 +141,10 @@ chunk {0} output.js (main) 329 [rendered]
```
Hash: 434f28b7ad3542e91dda
Version: webpack 1.0.0-beta8
Time: 127ms
Version: webpack 1.0.0-rc1
Time: 115ms
Asset Size Chunks Chunk Names
output.js 466 0 [emitted] main
output.js 421 0 [emitted] main
chunk {0} output.js (main) 329 [rendered]
> main [0] ./example.js
[0] ./example.js 69 {0} [built]

View File

@ -73,6 +73,8 @@ module.exports = {
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -81,7 +83,7 @@ module.exports = {
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -91,19 +93,15 @@ module.exports = {
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // The bundle contains no chunks. A empty chunk loading function.
/******/ require.e = function requireEnsure(_, callback) {
/******/ callback.call(null, this);
/******/ };
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ require.modules = modules;
@ -249,10 +247,10 @@ module.exports = {
```
Hash: 4053dc5307d47a5e1c7d
Version: webpack 1.0.0-beta8
Time: 191ms
Version: webpack 1.0.0-rc1
Time: 164ms
Asset Size Chunks Chunk Names
output.js 6042 0 [emitted] main
output.js 5938 0 [emitted] main
chunk {0} output.js (main) 1948 [rendered]
> main [0] ./example.js
[0] ./example.js 114 {0} [built]
@ -283,10 +281,10 @@ chunk {0} output.js (main) 1948 [rendered]
```
Hash: f3bcd87b1b45637bb5fb
Version: webpack 1.0.0-beta8
Time: 317ms
Version: webpack 1.0.0-rc1
Time: 252ms
Asset Size Chunks Chunk Names
output.js 1232 0 [emitted] main
output.js 1187 0 [emitted] main
chunk {0} output.js (main) 1921 [rendered]
> main [0] ./example.js
[0] ./example.js 114 {0} [built]

View File

@ -62,6 +62,8 @@ module.exports = {"this is": "z"};
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -70,7 +72,7 @@ module.exports = {"this is": "z"};
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -80,19 +82,15 @@ module.exports = {"this is": "z"};
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // The bundle contains no chunks. A empty chunk loading function.
/******/ require.e = function requireEnsure(_, callback) {
/******/ callback.call(null, this);
/******/ };
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ require.modules = modules;
@ -204,10 +202,10 @@ module.exports = {"this is": "z"};
```
Hash: 668737aba027e3d941f2
Version: webpack 1.0.0-beta8
Time: 78ms
Version: webpack 1.0.0-rc1
Time: 76ms
Asset Size Chunks Chunk Names
output.js 3468 0 [emitted] main
output.js 3364 0 [emitted] main
chunk {0} output.js (main) 528 [rendered]
> main [0] ./example.js
[0] ./example.js 76 {0} [built]
@ -235,10 +233,10 @@ chunk {0} output.js (main) 528 [rendered]
```
Hash: bc390fa076c28e8dc72c
Version: webpack 1.0.0-beta8
Time: 172ms
Version: webpack 1.0.0-rc1
Time: 152ms
Asset Size Chunks Chunk Names
output.js 771 0 [emitted] main
output.js 726 0 [emitted] main
chunk {0} output.js (main) 528 [rendered]
> main [0] ./example.js
[0] ./example.js 76 {0} [built]

View File

@ -0,0 +1,451 @@
# webpack.config.js
``` javascript
var path = require("path");
var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
module.exports = {
entry: {
// The entry points for the pages
pageA: "./aEntry",
pageB: "./bEntry",
// This file contains common modules but also the router entry
"commons.js": "./router"
},
output: {
path: path.join(__dirname, "js"),
filename: "[name].bundle.js",
chunkFilename: "[id].chunk.js"
},
plugins: [
// Extract common modules from the entries to the commons.js file
// This is optional, but good for performance.
new CommonsChunkPlugin("commons.js")
// The pages cannot run without the commons.js file now.
]
}
```
# aEntry.js
``` javascript
// Just show the page "a"
var render = require("./render");
render(require("./aPage"));
```
`bEntry.js` is similar. You may want to use a loader to generate this file.
# aPage.js
``` javascript
module.exports = function() {
return "This is page A.";
};
```
`bEntry.js` is similar.
# router.js
``` javascript
var render = require("./render");
// Event when another page should be opened
// Maybe hook click on links, hashchange or popstate
window.onLinkToPage = function onLinkToPage(name) { // name is "a" or "b"
// require the page with a dynamic require
// It's important that this require only matches the pages
// elsewise there is blood in the bundle. Here this is done with a
// specific file prefix. It's also possible to use a directory,
// overwriting the RegExp with the ContextReplacementPlugin, or
// using the require.context method.
// The bundle-loader is used to create a chunk from the page
// -> Pages are only loaded on demand
// This line may throw a exception on runtime if the page wasn't found.
var pageBundle = require("bundle!./" + name + "Page");
// Wait until the chunk is loaded
pageBundle(function(page) {
render(page);
});
}
```
# pageA.html
``` html
<html>
<head></head>
<body>
<script src="js/commons.js" charset="utf-8"></script>
<script src="js/pageA.bundle.js" charset="utf-8"></script>
</body>
</html>
```
# js/commons.js
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // object to store loaded and loading chunks
/******/ // "0" means "already loaded"
/******/ // Array means "loading", array contains callbacks
/******/ var installedChunks = {
/******/ 0:0
/******/ };
/******/
/******/ // 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(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module[exports];
/******/ }
/******/
/******/ // This file contains only the entry chunk.
/******/ // The chunk loading function for additional chunks
/******/ require.e = function requireEnsure(chunkId, callback) {
/******/ // "0" is the signal for "already loaded"
/******/ if(installedChunks[chunkId] === 0)
/******/ return callback.call(null, require);
/******/
/******/ // an array means "currently loading".
/******/ if(installedChunks[chunkId] !== undefined) {
/******/ installedChunks[chunkId].push(callback);
/******/ } else {
/******/ // start chunk loading
/******/ installedChunks[chunkId] = [callback];
/******/ var head = document.getElementsByTagName('head')[0];
/******/ var script = document.createElement('script');
/******/ script.type = 'text/javascript';
/******/ script.charset = 'utf-8';
/******/ script.src = require.p + "" + chunkId + ".chunk.js";
/******/ head.appendChild(script);
/******/ }
/******/ };
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ require.modules = modules;
/******/
/******/ // expose the module cache
/******/ require.cache = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ require.p = "js/";
/******/
/******/ // install a JSONP callback for chunk loading
/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) {
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, callbacks = [];
/******/ while(chunkIds.length) {
/******/ chunkId = chunkIds.shift();
/******/ if(installedChunks[chunkId])
/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]);
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/ for(moduleId in moreModules) {
/******/ modules[moduleId] = moreModules[moduleId];
/******/ }
/******/ while(callbacks.length)
/******/ callbacks.shift().call(null, require);
/******/ if(moreModules[0]) {
/******/ installedModules[0] = 0;
/******/ require(0);
/******/ }
/******/ };
/******/
/******/ // Load entry module and return exports
/******/ return require(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/*!*******************!*\
!*** ./router.js ***!
\*******************/
/***/ function(module, exports, require) {
var render = require(/*! ./render */ 3);
// Event when another page should be opened
// Maybe hook click on links, hashchange or popstate
window.onLinkToPage = function onLinkToPage(name) { // name is "a" or "b"
// require the page with a dynamic require
// It's important that this require only matches the pages
// elsewise there is blood in the bundle. Here this is done with a
// specific file prefix. It's also possible to use a directory,
// overwriting the RegExp with the ContextReplacementPlugin, or
// using the require.context method.
// The bundle-loader is used to create a chunk from the page
// -> Pages are only loaded on demand
// This line may throw a exception on runtime if the page wasn't found.
var pageBundle = require(/*! bundle!. */ 4)("./" + name + "Page");
// Wait until the chunk is loaded
pageBundle(function(page) {
render(page);
});
}
/***/ },
/* 1 */,
/* 2 */,
/* 3 */
/*!*******************!*\
!*** ./render.js ***!
\*******************/
/***/ function(module, exports, require) {
module.exports = function(page) {
console.log(page());
};
/***/ },
/* 4 */
/*!************************************************!*\
!*** . (webpack)/~/bundle-loader!^\.\/.*Page$ ***!
\************************************************/
/***/ function(module, exports, require) {
var map = {
"./aPage": 5,
"./bPage": 6
};
function webpackContext(req) {
return require(webpackContextResolve(req));
};
function webpackContextResolve(req) {
return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }());
};
webpackContext.keys = function webpackContextKeys() {
return Object.keys(map);
};
webpackContext.resolve = webpackContextResolve;
module.exports = webpackContext;
/***/ },
/* 5 */
/*!********************************************!*\
!*** (webpack)/~/bundle-loader!./aPage.js ***!
\********************************************/
/***/ function(module, exports, require) {
var cbs = [],
data;
module.exports = function(cb) {
if(cbs) cbs.push(cb);
else cb(data);
}
require.e/*nsure*/(2, function(require) {
data = require(/*! !./aPage.js */ 1);
var callbacks = cbs;
cbs = null;
for(var i = 0, l = callbacks.length; i < l; i++) {
callbacks[i](data);
}
});
/***/ },
/* 6 */
/*!********************************************!*\
!*** (webpack)/~/bundle-loader!./bPage.js ***!
\********************************************/
/***/ function(module, exports, require) {
var cbs = [],
data;
module.exports = function(cb) {
if(cbs) cbs.push(cb);
else cb(data);
}
require.e/*nsure*/(1, function(require) {
data = require(/*! !./bPage.js */ 2);
var callbacks = cbs;
cbs = null;
for(var i = 0, l = callbacks.length; i < l; i++) {
callbacks[i](data);
}
});
/***/ }
/******/ ])
```
# js/pageA.bundle.js
``` javascript
webpackJsonp([0,2],[
/* 0 */
/*!*******************!*\
!*** ./aEntry.js ***!
\*******************/
/***/ function(module, exports, require) {
// Just show the page "a"
var render = require(/*! ./render */ 3);
render(require(/*! ./aPage */ 1));
/***/ },
/* 1 */
/*!******************!*\
!*** ./aPage.js ***!
\******************/
/***/ function(module, exports, require) {
module.exports = function() {
return "This is page A.";
};
/***/ }
])
```
# js/1.chunk.js
``` javascript
webpackJsonp([1],{
/***/ 2:
/*!******************!*\
!*** ./bPage.js ***!
\******************/
/***/ function(module, exports, require) {
module.exports = function() {
return "This is page B.";
};
/***/ }
})
```
# Info
## Uncompressed
```
Hash: e732ab879d2805e1967c
Version: webpack 1.0.0-rc1
Time: 108ms
Asset Size Chunks Chunk Names
pageB.bundle.js 472 0, 1 [emitted] pageB
pageA.bundle.js 463 0, 2 [emitted] pageA
commons.js 6511 0 [emitted] commons.js
1.chunk.js 221 1 [emitted]
2.chunk.js 227 2 [emitted]
chunk {0} pageB.bundle.js (pageB) 150 {0} [rendered]
> pageB [0] ./bEntry.js
[0] ./bEntry.js 89 {0} [built]
[2] ./bPage.js 61 {0} {1} [built]
cjs require ./bPage [0] ./bEntry.js 3:7-25
cjs require !!.\bPage.js [6] (webpack)/~/bundle-loader!./bPage.js 8:8-106
chunk {0} pageA.bundle.js (pageA) 150 {0} [rendered]
> pageA [0] ./aEntry.js
[0] ./aEntry.js 89 {0} [built]
[1] ./aPage.js 61 {0} {2} [built]
cjs require ./aPage [0] ./aEntry.js 3:7-25
cjs require !!.\aPage.js [5] (webpack)/~/bundle-loader!./aPage.js 8:8-106
chunk {0} commons.js (commons.js) 1852 [rendered]
> commons.js [0] ./router.js
[0] ./router.js 894 {0} [built]
[3] ./render.js 60 {0} [built]
cjs require ./render [0] ./aEntry.js 2:13-32
cjs require ./render [0] ./bEntry.js 2:13-32
cjs require ./render [0] ./router.js 1:13-32
[4] . (webpack)/~/bundle-loader!^\.\/.*Page$ 184 {0} [built]
cjs require context bundle!. [0] ./router.js 18:18-54
[5] (webpack)/~/bundle-loader!./aPage.js 357 {0} [built]
context element ./aPage [4] . (webpack)/~/bundle-loader!^\.\/.*Page$
[6] (webpack)/~/bundle-loader!./bPage.js 357 {0} [built]
context element ./bPage [4] . (webpack)/~/bundle-loader!^\.\/.*Page$
chunk {1} 1.chunk.js 61 {0} [rendered]
> [6] (webpack)/~/bundle-loader!./bPage.js 7:0-14:2
[2] ./bPage.js 61 {0} {1} [built]
cjs require ./bPage [0] ./bEntry.js 3:7-25
cjs require !!.\bPage.js [6] (webpack)/~/bundle-loader!./bPage.js 8:8-106
chunk {2} 2.chunk.js 61 {0} [rendered]
> [5] (webpack)/~/bundle-loader!./aPage.js 7:0-14:2
[1] ./aPage.js 61 {0} {2} [built]
cjs require ./aPage [0] ./aEntry.js 3:7-25
cjs require !!.\aPage.js [5] (webpack)/~/bundle-loader!./aPage.js 8:8-106
```
## Minimized (uglify-js, no zip)
```
Hash: d8d3e60ef2e3ea93c827
Version: webpack 1.0.0-rc1
Time: 263ms
Asset Size Chunks Chunk Names
pageB.bundle.js 118 0, 1 [emitted] pageB
pageA.bundle.js 117 0, 2 [emitted] pageA
commons.js 1361 0 [emitted] commons.js
1.chunk.js 81 1 [emitted]
2.chunk.js 80 2 [emitted]
chunk {0} pageB.bundle.js (pageB) 150 {0} [rendered]
> pageB [0] ./bEntry.js
[0] ./bEntry.js 89 {0} [built]
[2] ./bPage.js 61 {0} {1} [built]
cjs require ./bPage [0] ./bEntry.js 3:7-25
cjs require !!.\bPage.js [6] (webpack)/~/bundle-loader!./bPage.js 8:8-106
chunk {0} pageA.bundle.js (pageA) 150 {0} [rendered]
> pageA [0] ./aEntry.js
[0] ./aEntry.js 89 {0} [built]
[1] ./aPage.js 61 {0} {2} [built]
cjs require ./aPage [0] ./aEntry.js 3:7-25
cjs require !!.\aPage.js [5] (webpack)/~/bundle-loader!./aPage.js 8:8-106
chunk {0} commons.js (commons.js) 1852 [rendered]
> commons.js [0] ./router.js
[0] ./router.js 894 {0} [built]
[3] ./render.js 60 {0} [built]
cjs require ./render [0] ./aEntry.js 2:13-32
cjs require ./render [0] ./bEntry.js 2:13-32
cjs require ./render [0] ./router.js 1:13-32
[4] . (webpack)/~/bundle-loader!^\.\/.*Page$ 184 {0} [built]
cjs require context bundle!. [0] ./router.js 18:18-54
[5] (webpack)/~/bundle-loader!./aPage.js 357 {0} [built]
context element ./aPage [4] . (webpack)/~/bundle-loader!^\.\/.*Page$
[6] (webpack)/~/bundle-loader!./bPage.js 357 {0} [built]
context element ./bPage [4] . (webpack)/~/bundle-loader!^\.\/.*Page$
chunk {1} 1.chunk.js 61 {0} [rendered]
> [6] (webpack)/~/bundle-loader!./bPage.js 7:0-14:2
[2] ./bPage.js 61 {0} {1} [built]
cjs require ./bPage [0] ./bEntry.js 3:7-25
cjs require !!.\bPage.js [6] (webpack)/~/bundle-loader!./bPage.js 8:8-106
chunk {2} 2.chunk.js 61 {0} [rendered]
> [5] (webpack)/~/bundle-loader!./aPage.js 7:0-14:2
[1] ./aPage.js 61 {0} {2} [built]
cjs require ./aPage [0] ./aEntry.js 3:7-25
cjs require !!.\aPage.js [5] (webpack)/~/bundle-loader!./aPage.js 8:8-106
```

View File

@ -0,0 +1,3 @@
// Just show the page "a"
var render = require("./render");
render(require("./aPage"));

View File

@ -0,0 +1,3 @@
module.exports = function() {
return "This is page A.";
};

View File

@ -0,0 +1,3 @@
// Just show the page "b"
var render = require("./render");
render(require("./bPage"));

View File

@ -0,0 +1,3 @@
module.exports = function() {
return "This is page B.";
};

View File

@ -0,0 +1,2 @@
global.NO_TARGET_ARGS = true;
require("../build-common");

View File

@ -0,0 +1,7 @@
<html>
<head></head>
<body>
<script src="js/commons.js" charset="utf-8"></script>
<script src="js/pageA.bundle.js" charset="utf-8"></script>
</body>
</html>

View File

@ -0,0 +1,7 @@
<html>
<head></head>
<body>
<script src="js/commons.js" charset="utf-8"></script>
<script src="js/pageB.bundle.js" charset="utf-8"></script>
</body>
</html>

View File

@ -0,0 +1,3 @@
module.exports = function(page) {
console.log(page());
};

View File

@ -0,0 +1,24 @@
var render = require("./render");
// Event when another page should be opened
// Maybe hook click on links, hashchange or popstate
window.onLinkToPage = function onLinkToPage(name) { // name is "a" or "b"
// require the page with a dynamic require
// It's important that this require only matches the pages
// elsewise there is blood in the bundle. Here this is done with a
// specific file prefix. It's also possible to use a directory,
// overwriting the RegExp with the ContextReplacementPlugin, or
// using the require.context method.
// The bundle-loader is used to create a chunk from the page
// -> Pages are only loaded on demand
// This line may throw a exception on runtime if the page wasn't found.
var pageBundle = require("bundle!./" + name + "Page");
// Wait until the chunk is loaded
pageBundle(function(page) {
render(page);
});
}

View File

@ -0,0 +1,65 @@
# webpack.config.js
``` javascript
{{webpack.config.js}}
```
# aEntry.js
``` javascript
{{aEntry.js}}
```
`bEntry.js` is similar. You may want to use a loader to generate this file.
# aPage.js
``` javascript
{{aPage.js}}
```
`bEntry.js` is similar.
# router.js
``` javascript
{{router.js}}
```
# pageA.html
``` html
{{pageA.html}}
```
# js/commons.js
``` javascript
{{js/commons.js}}
```
# js/pageA.bundle.js
``` javascript
{{js/pageA.bundle.js}}
```
# js/1.chunk.js
``` javascript
{{js/1.chunk.js}}
```
# Info
## Uncompressed
```
{{stdout}}
```
## Minimized (uglify-js, no zip)
```
{{min:stdout}}
```

View File

@ -0,0 +1,23 @@
var path = require("path");
var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
module.exports = {
entry: {
// The entry points for the pages
pageA: "./aEntry",
pageB: "./bEntry",
// This file contains common modules but also the router entry
"commons.js": "./router"
},
output: {
path: path.join(__dirname, "js"),
filename: "[name].bundle.js",
chunkFilename: "[id].chunk.js"
},
plugins: [
// Extract common modules from the entries to the commons.js file
// This is optional, but good for performance.
new CommonsChunkPlugin("commons.js")
// The pages cannot run without the commons.js file now.
]
}

View File

@ -34,6 +34,8 @@ module.exports = {
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -42,7 +44,7 @@ module.exports = {
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -52,19 +54,15 @@ module.exports = {
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // The bundle contains no chunks. A empty chunk loading function.
/******/ require.e = function requireEnsure(_, callback) {
/******/ callback.call(null, this);
/******/ };
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ require.modules = modules;
@ -100,10 +98,10 @@ module.exports = {
```
Hash: 3bd94df73dbb84d38341
Version: webpack 1.0.0-beta8
Time: 51ms
Version: webpack 1.0.0-rc1
Time: 45ms
Asset Size Chunks Chunk Names
output.js 1783 0 [emitted] main
output.js 1679 0 [emitted] main
chunk {0} output.js (main) 65 [rendered]
> main [0] ./example.js
[0] ./example.js 65 {0} [built] [1 warning]
@ -116,10 +114,10 @@ Missing localization: Missing Text
```
Hash: 1ad5b360e07d437790fd
Version: webpack 1.0.0-beta8
Time: 107ms
Version: webpack 1.0.0-rc1
Time: 93ms
Asset Size Chunks Chunk Names
output.js 318 0 [emitted] main
output.js 273 0 [emitted] main
chunk {0} output.js (main) 65 [rendered]
> main [0] ./example.js
[0] ./example.js 65 {0} [built] [1 warning]

View File

@ -31,6 +31,8 @@ exports: function add() {
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -39,7 +41,7 @@ exports: function add() {
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -49,19 +51,15 @@ exports: function add() {
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // The bundle contains no chunks. A empty chunk loading function.
/******/ require.e = function requireEnsure(_, callback) {
/******/ callback.call(null, this);
/******/ };
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ require.modules = modules;
@ -127,10 +125,10 @@ The remaining labels are removed while minimizing.
```
Hash: a09dcd87bf9b88c5e137
Version: webpack 1.0.0-beta8
Time: 58ms
Version: webpack 1.0.0-rc1
Time: 54ms
Asset Size Chunks Chunk Names
output.js 2527 0 [emitted] main
output.js 2423 0 [emitted] main
chunk {0} output.js (main) 299 [rendered]
> main [0] ./example.js
[0] ./example.js 55 {0} [built]
@ -144,10 +142,10 @@ chunk {0} output.js (main) 299 [rendered]
```
Hash: 11e5fd17e7fdce2603db
Version: webpack 1.0.0-beta8
Time: 126ms
Version: webpack 1.0.0-rc1
Time: 118ms
Asset Size Chunks Chunk Names
output.js 474 0 [emitted] main
output.js 429 0 [emitted] main
chunk {0} output.js (main) 299 [rendered]
> main [0] ./example.js
[0] ./example.js 55 {0} [built]

View File

@ -35,6 +35,8 @@ module.exports = function(content) {
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -43,7 +45,7 @@ module.exports = function(content) {
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -53,19 +55,15 @@ module.exports = function(content) {
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // The bundle contains no chunks. A empty chunk loading function.
/******/ require.e = function requireEnsure(_, callback) {
/******/ callback.call(null, this);
/******/ };
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ require.modules = modules;
@ -136,10 +134,10 @@ Prints in node.js (`enhanced-require example.js`) and in browser:
```
Hash: 547826c0f7b5903a42b6
Version: webpack 1.0.0-beta8
Time: 79ms
Version: webpack 1.0.0-rc1
Time: 77ms
Asset Size Chunks Chunk Names
output.js 2413 0 [emitted] main
output.js 2309 0 [emitted] main
chunk {0} output.js (main) 282 [rendered]
> main [0] ./example.js
[0] ./example.js 205 {0} [built]
@ -154,10 +152,10 @@ chunk {0} output.js (main) 282 [rendered]
```
Hash: 2c75b96c30dd80131187
Version: webpack 1.0.0-beta8
Time: 129ms
Version: webpack 1.0.0-rc1
Time: 124ms
Asset Size Chunks Chunk Names
output.js 399 0 [emitted] main
output.js 354 0 [emitted] main
chunk {0} output.js (main) 282 [rendered]
> main [0] ./example.js
[0] ./example.js 205 {0} [built]

View File

@ -76,6 +76,8 @@ require(
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -91,7 +93,7 @@ require(
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -101,13 +103,13 @@ require(
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // This file contains only the entry chunk.
@ -316,10 +318,10 @@ webpackJsonp([1],[
```
Hash: f9a4e0a95f5952cff0ba
Version: webpack 1.0.0-beta8
Time: 91ms
Version: webpack 1.0.0-rc1
Time: 90ms
Asset Size Chunks Chunk Names
output.js 6238 0 [emitted] main
output.js 6321 0 [emitted] main
1.output.js 1596 1 [emitted]
chunk {0} output.js (main) 1395 [rendered]
> main [0] ./example.js
@ -364,10 +366,10 @@ chunk {1} 1.output.js 439 {0} [rendered]
```
Hash: fc7dcc7368e6ec3feb58
Version: webpack 1.0.0-beta8
Time: 258ms
Version: webpack 1.0.0-rc1
Time: 236ms
Asset Size Chunks Chunk Names
output.js 1146 0 [emitted] main
output.js 1138 0 [emitted] main
1.output.js 507 1 [emitted]
chunk {0} output.js (main) 1395 [rendered]
> main [0] ./example.js

View File

@ -69,6 +69,8 @@ module.exports = {
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -85,7 +87,7 @@ module.exports = {
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -95,13 +97,13 @@ module.exports = {
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // This file contains only the entry chunk.
@ -151,7 +153,7 @@ module.exports = {
/******/ }
/******/ while(callbacks.length)
/******/ callbacks.shift().call(null, require);
/******/ if(0 in moreModules) {
/******/ if(moreModules[0]) {
/******/ installedModules[0] = 0;
/******/ require(0);
/******/ }
@ -254,8 +256,8 @@ webpackJsonp([0],[
```
Hash: 632167db14ad20539b46
Version: webpack 1.0.0-beta8
Time: 94ms
Version: webpack 1.0.0-rc1
Time: 87ms
Asset Size Chunks Chunk Names
pageC.js 583 0 [emitted] pageC
pageB.js 440 0 [emitted] pageB
@ -264,8 +266,8 @@ Time: 94ms
adminPageB.js 241 0 [emitted] adminPageB
adminPageA.js 241 0 [emitted] adminPageA
admin-commons.js 181 1 [emitted] admin-commons.js
commons.js 3685 2, 3 [emitted] commons.js
c-commons.js 3521 3 [emitted] c-commons.js
commons.js 3766 2, 3 [emitted] commons.js
c-commons.js 3602 3 [emitted] c-commons.js
chunk {0} pageC.js (pageC) 83 {3} [rendered]
> pageC [0] ./pageC.js
[0] ./pageC.js 83 {0} [built]
@ -291,8 +293,8 @@ chunk {0} adminPageC.js (adminPageC) 56 {3} [rendered]
> adminPageC [0] ./adminPageC.js
[0] ./adminPageC.js 56 {0} [built]
[2] ./modules/admin.js 0 {0} {1} [built]
cjs require ./modules/admin [0] ./adminPageA.js 2:0-26
cjs require ./modules/admin [0] ./adminPageB.js 2:0-26
cjs require ./modules/admin [0] ./adminPageA.js 2:0-26
cjs require ./modules/admin [0] ./adminPageC.js 2:0-26
chunk {0} adminPageB.js (adminPageB) 56 {1} [rendered]
> adminPageB [0] ./adminPageB.js
@ -302,27 +304,27 @@ chunk {0} adminPageA.js (adminPageA) 56 {1} [rendered]
[0] ./adminPageA.js 56 {0} [built]
chunk {1} admin-commons.js (admin-commons.js) 0 {2} [rendered]
[2] ./modules/admin.js 0 {0} {1} [built]
cjs require ./modules/admin [0] ./adminPageA.js 2:0-26
cjs require ./modules/admin [0] ./adminPageB.js 2:0-26
cjs require ./modules/admin [0] ./adminPageA.js 2:0-26
cjs require ./modules/admin [0] ./adminPageC.js 2:0-26
chunk {2} commons.js (commons.js) 0 [rendered]
[1] ./modules/a-b-c.js 0 {2} {3} [built]
cjs require ./modules/a-b-c [0] ./pageA.js 1:0-26
cjs require ./modules/a-b-c [0] ./pageB.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageA.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageB.js 1:0-26
cjs require ./modules/a-b-c [0] ./pageA.js 1:0-26
cjs require ./modules/a-b-c [0] ./pageC.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageB.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageA.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageC.js 1:0-26
[5] ./modules/a-b.js 0 {2} [built]
cjs require ./modules/a-b [0] ./pageA.js 2:0-24
cjs require ./modules/a-b [0] ./pageB.js 2:0-24
cjs require ./modules/a-b [0] ./pageA.js 2:0-24
chunk {3} c-commons.js (c-commons.js) 0 [rendered]
[1] ./modules/a-b-c.js 0 {2} {3} [built]
cjs require ./modules/a-b-c [0] ./pageA.js 1:0-26
cjs require ./modules/a-b-c [0] ./pageB.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageA.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageB.js 1:0-26
cjs require ./modules/a-b-c [0] ./pageA.js 1:0-26
cjs require ./modules/a-b-c [0] ./pageC.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageB.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageA.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageC.js 1:0-26
```
@ -330,8 +332,8 @@ chunk {3} c-commons.js (c-commons.js) 0 [rendered]
```
Hash: a0098339a876b694d407
Version: webpack 1.0.0-beta8
Time: 271ms
Version: webpack 1.0.0-rc1
Time: 238ms
Asset Size Chunks Chunk Names
pageC.js 80 0 [emitted] pageC
pageB.js 68 0 [emitted] pageB
@ -340,8 +342,8 @@ Time: 271ms
adminPageB.js 47 0 [emitted] adminPageB
adminPageA.js 47 0 [emitted] adminPageA
admin-commons.js 35 1 [emitted] admin-commons.js
commons.js 696 2, 3 [emitted] commons.js
c-commons.js 676 3 [emitted] c-commons.js
commons.js 686 2, 3 [emitted] commons.js
c-commons.js 666 3 [emitted] c-commons.js
chunk {0} pageC.js (pageC) 83 {3} [rendered]
> pageC [0] ./pageC.js
[0] ./pageC.js 83 {0} [built]
@ -349,14 +351,14 @@ chunk {0} pageC.js (pageC) 83 {3} [rendered]
cjs require ./modules/a-c [0] ./pageA.js 3:0-24
cjs require ./modules/a-c [0] ./pageC.js 3:0-24
[4] ./modules/b-c.js 0 {0} {0} [built]
cjs require ./modules/b-c [0] ./pageC.js 2:0-24
cjs require ./modules/b-c [0] ./pageB.js 3:0-24
cjs require ./modules/b-c [0] ./pageC.js 2:0-24
chunk {0} pageB.js (pageB) 83 {2} [rendered]
> pageB [0] ./pageB.js
[0] ./pageB.js 83 {0} [built]
[4] ./modules/b-c.js 0 {0} {0} [built]
cjs require ./modules/b-c [0] ./pageC.js 2:0-24
cjs require ./modules/b-c [0] ./pageB.js 3:0-24
cjs require ./modules/b-c [0] ./pageC.js 2:0-24
chunk {0} pageA.js (pageA) 83 {2} [rendered]
> pageA [0] ./pageA.js
[0] ./pageA.js 83 {0} [built]
@ -367,9 +369,9 @@ chunk {0} adminPageC.js (adminPageC) 56 {3} [rendered]
> adminPageC [0] ./adminPageC.js
[0] ./adminPageC.js 56 {0} [built]
[2] ./modules/admin.js 0 {0} {1} [built]
cjs require ./modules/admin [0] ./adminPageA.js 2:0-26
cjs require ./modules/admin [0] ./adminPageB.js 2:0-26
cjs require ./modules/admin [0] ./adminPageC.js 2:0-26
cjs require ./modules/admin [0] ./adminPageA.js 2:0-26
chunk {0} adminPageB.js (adminPageB) 56 {1} [rendered]
> adminPageB [0] ./adminPageB.js
[0] ./adminPageB.js 56 {0} [built]
@ -378,26 +380,26 @@ chunk {0} adminPageA.js (adminPageA) 56 {1} [rendered]
[0] ./adminPageA.js 56 {0} [built]
chunk {1} admin-commons.js (admin-commons.js) 0 {2} [rendered]
[2] ./modules/admin.js 0 {0} {1} [built]
cjs require ./modules/admin [0] ./adminPageA.js 2:0-26
cjs require ./modules/admin [0] ./adminPageB.js 2:0-26
cjs require ./modules/admin [0] ./adminPageC.js 2:0-26
cjs require ./modules/admin [0] ./adminPageA.js 2:0-26
chunk {2} commons.js (commons.js) 0 [rendered]
[1] ./modules/a-b-c.js 0 {2} {3} [built]
cjs require ./modules/a-b-c [0] ./pageA.js 1:0-26
cjs require ./modules/a-b-c [0] ./pageC.js 1:0-26
cjs require ./modules/a-b-c [0] ./pageB.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageA.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageB.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageC.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageA.js 1:0-26
cjs require ./modules/a-b-c [0] ./pageC.js 1:0-26
[5] ./modules/a-b.js 0 {2} [built]
cjs require ./modules/a-b [0] ./pageA.js 2:0-24
cjs require ./modules/a-b [0] ./pageB.js 2:0-24
chunk {3} c-commons.js (c-commons.js) 0 [rendered]
[1] ./modules/a-b-c.js 0 {2} {3} [built]
cjs require ./modules/a-b-c [0] ./pageA.js 1:0-26
cjs require ./modules/a-b-c [0] ./pageC.js 1:0-26
cjs require ./modules/a-b-c [0] ./pageB.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageA.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageB.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageC.js 1:0-26
cjs require ./modules/a-b-c [0] ./adminPageA.js 1:0-26
cjs require ./modules/a-b-c [0] ./pageC.js 1:0-26
```

View File

@ -54,6 +54,8 @@ module.exports = {
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -69,7 +71,7 @@ module.exports = {
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -79,13 +81,13 @@ module.exports = {
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // This file contains only the entry chunk.
@ -135,7 +137,7 @@ module.exports = {
/******/ }
/******/ while(callbacks.length)
/******/ callbacks.shift().call(null, require);
/******/ if(0 in moreModules) {
/******/ if(moreModules[0]) {
/******/ installedModules[0] = 0;
/******/ require(0);
/******/ }
@ -222,13 +224,13 @@ webpackJsonp([1],{
```
Hash: 47b86d59381d9838be03
Version: webpack 1.0.0-beta8
Time: 78ms
Version: webpack 1.0.0-rc1
Time: 68ms
Asset Size Chunks Chunk Names
pageB.bundle.js 318 0 [emitted] pageB
pageA.bundle.js 425 0 [emitted] pageA
1.chunk.js 262 1 [emitted]
commons.js 3532 2 [emitted] commons.js
commons.js 3613 2 [emitted] commons.js
chunk {0} pageB.bundle.js (pageB) 152 {2} [rendered]
> pageB [0] ./pageB.js
[0] ./pageB.js 152 {0} [built]
@ -253,13 +255,13 @@ chunk {2} commons.js (commons.js) 26 [rendered]
```
Hash: 1ac09da9c3c76f747c8b
Version: webpack 1.0.0-beta8
Time: 184ms
Version: webpack 1.0.0-rc1
Time: 167ms
Asset Size Chunks Chunk Names
pageB.bundle.js 93 0 [emitted] pageB
pageA.bundle.js 124 0 [emitted] pageA
1.chunk.js 82 1 [emitted]
commons.js 700 2 [emitted] commons.js
commons.js 690 2 [emitted] commons.js
chunk {0} pageB.bundle.js (pageB) 152 {2} [rendered]
> pageB [0] ./pageB.js
[0] ./pageB.js 152 {0} [built]

View File

@ -29,6 +29,8 @@ require.ensure(["b"], function(require) {
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -44,7 +46,7 @@ require.ensure(["b"], function(require) {
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -54,13 +56,13 @@ require.ensure(["b"], function(require) {
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // This file contains only the entry chunk.
@ -229,10 +231,10 @@ webpackJsonp([2],[
```
Hash: d6659e1367a79bf5a8ba
Version: webpack 1.0.0-beta8
Time: 79ms
Version: webpack 1.0.0-rc1
Time: 71ms
Asset Size Chunks Chunk Names
output.js 4161 0 [emitted] main
output.js 4244 0 [emitted] main
1.output.js 460 1, 2 [emitted] my own chunk
my own chunk.js 460 1, 2 [emitted] my own chunk
2.output.js 309 2 [emitted]
@ -269,10 +271,10 @@ chunk {2} 2.output.js 22 {0} [rendered]
```
Hash: 09fb39f6bd4bb14e4d65
Version: webpack 1.0.0-beta8
Time: 185ms
Version: webpack 1.0.0-rc1
Time: 174ms
Asset Size Chunks Chunk Names
output.js 796 0 [emitted] main
output.js 788 0 [emitted] main
1.output.js 63 1, 2 [emitted] my own chunk
my own chunk.js 63 1, 2 [emitted] my own chunk
2.output.js 47 2 [emitted]

View File

@ -26,6 +26,8 @@ module.exports = function() {
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -34,7 +36,7 @@ module.exports = function() {
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -44,19 +46,15 @@ module.exports = function() {
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // The bundle contains no chunks. A empty chunk loading function.
/******/ require.e = function requireEnsure(_, callback) {
/******/ callback.call(null, this);
/******/ };
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ require.modules = modules;
@ -156,10 +154,10 @@ module.exports = function() {
```
Hash: 1853a9528b05335d6ca9
Version: webpack 1.0.0-beta8
Time: 60ms
Version: webpack 1.0.0-rc1
Time: 58ms
Asset Size Chunks Chunk Names
output.js 3252 0 [emitted] main
output.js 3148 0 [emitted] main
chunk {0} output.js (main) 613 [rendered]
> main [0] ./example.js
[0] ./example.js 150 {0} [built]
@ -180,10 +178,10 @@ chunk {0} output.js (main) 613 [rendered]
```
Hash: 368d2da3d6d88e7d3822
Version: webpack 1.0.0-beta8
Time: 139ms
Version: webpack 1.0.0-rc1
Time: 143ms
Asset Size Chunks Chunk Names
output.js 850 0 [emitted] main
output.js 805 0 [emitted] main
chunk {0} output.js (main) 613 [rendered]
> main [0] ./example.js
[0] ./example.js 150 {0} [built]

View File

@ -27,6 +27,8 @@ module.exports = Math.random();
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -35,7 +37,7 @@ module.exports = Math.random();
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -45,19 +47,15 @@ module.exports = Math.random();
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // The bundle contains no chunks. A empty chunk loading function.
/******/ require.e = function requireEnsure(_, callback) {
/******/ callback.call(null, this);
/******/ };
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ require.modules = modules;
@ -113,10 +111,10 @@ module.exports = Math.random();
```
Hash: c2fdaa4ec2268af6ce80
Version: webpack 1.0.0-beta8
Time: 55ms
Version: webpack 1.0.0-rc1
Time: 52ms
Asset Size Chunks Chunk Names
output.js 2208 0 [emitted] main
output.js 2104 0 [emitted] main
chunk {0} output.js (main) 326 [rendered]
> main [0] ./example.js
[0] ./example.js 295 {0} [built]
@ -130,10 +128,10 @@ chunk {0} output.js (main) 326 [rendered]
```
Hash: 9035669d7274300bd13b
Version: webpack 1.0.0-beta8
Time: 124ms
Version: webpack 1.0.0-rc1
Time: 114ms
Asset Size Chunks Chunk Names
output.js 399 0 [emitted] main
output.js 354 0 [emitted] main
chunk {0} output.js (main) 326 [rendered]
> main [0] ./example.js
[0] ./example.js 295 {0} [built]

View File

@ -26,6 +26,8 @@ onmessage = function(event) {
``` javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // shortcut for better minimizing
/******/ var exports = "exports";
/******/
/******/ // The module cache
/******/ var installedModules = {};
@ -34,7 +36,7 @@ onmessage = function(event) {
/******/ function require(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ return installedModules[moduleId][exports];
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
@ -44,19 +46,15 @@ onmessage = function(event) {
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, require);
/******/ modules[moduleId].call(module[exports], module, module[exports], require);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ return module[exports];
/******/ }
/******/
/******/ // The bundle contains no chunks. A empty chunk loading function.
/******/ require.e = function requireEnsure(_, callback) {
/******/ callback.call(null, this);
/******/ };
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ require.modules = modules;
@ -262,12 +260,12 @@ webpackChunk([1],[
```
Hash: d3a484ec9964172dc379
Version: webpack 1.0.0-beta8
Time: 131ms
Version: webpack 1.0.0-rc1
Time: 114ms
Asset Size Chunks Chunk Names
hash.worker.js 2697 [emitted]
1.hash.worker.js 1593 [emitted]
output.js 2244 0 [emitted] main
output.js 2140 0 [emitted] main
chunk {0} output.js (main) 302 [rendered]
> main [0] ./example.js
[0] ./example.js 206 {0} [built]
@ -275,7 +273,7 @@ chunk {0} output.js (main) 302 [rendered]
cjs require worker!./worker [0] ./example.js 1:13-39
Child worker:
Hash: f8be7dd704b535b316bd
Version: webpack 1.0.0-beta8
Version: webpack 1.0.0-rc1
Asset Size Chunks Chunk Names
hash.worker.js 2697 0 [emitted] main
1.hash.worker.js 1593 1 [emitted]
@ -301,12 +299,12 @@ Child worker:
```
Hash: e028e5c3f2a9ee017ccf
Version: webpack 1.0.0-beta8
Time: 245ms
Version: webpack 1.0.0-rc1
Time: 225ms
Asset Size Chunks Chunk Names
hash.worker.js 523 [emitted]
1.hash.worker.js 528 [emitted]
output.js 418 0 [emitted] main
output.js 373 0 [emitted] main
chunk {0} output.js (main) 302 [rendered]
> main [0] ./example.js
[0] ./example.js 206 {0} [built]
@ -317,7 +315,7 @@ WARNING in output.js from UglifyJs
Side effects in initialization of unused variable templateB [./example.js:5,0]
Child worker:
Hash: 5a60a9d218768e784433
Version: webpack 1.0.0-beta8
Version: webpack 1.0.0-rc1
Asset Size Chunks Chunk Names
hash.worker.js 523 0 [emitted] main
1.hash.worker.js 528 1 [emitted]