Skip to content

Commit

Permalink
updated examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Oct 8, 2012
1 parent d5fc111 commit 0fb1fa8
Show file tree
Hide file tree
Showing 14 changed files with 145 additions and 205 deletions.
2 changes: 1 addition & 1 deletion examples/build-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
require = require("../require-polyfill")(require.valueOf());
require = require("enhanced-require")(module);

var cp = require('child_process');
var tc = require("./template-common");
Expand Down
58 changes: 27 additions & 31 deletions examples/code-splitted-require.context-amd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ getTemplate("a", function(a) {
getTemplate("b", function(b) {
console.log(b);
});
/******/ /* WEBPACK FREE VAR INJECTION */ }(require(/* __webpack_amd_require */2)(require),require(/* __webpack_console */1)))
/******/ /* WEBPACK FREE VAR INJECTION */ }(require(/* __webpack_amd_require */2),require(/* __webpack_console */1)))

/******/},
/******/
Expand Down Expand Up @@ -107,26 +107,24 @@ console.timeEnd = function() {

/*** (webpack)\buildin\__webpack_amd_require.js ***/

function amdRequireFactory(req) {
function amdRequire(chunk, requiresFn, fn) {
if(!requiresFn) {
// commonjs
return req(chunk);
}
req.e(chunk, function() {
var modules = requiresFn();
if(fn)
return fn.apply(null, modules);
});
var req = require.valueOf();
function amdRequire(chunk, requiresFn, fn) {
if(!requiresFn) {
// commonjs
return req(chunk);
}
for(var name in req)
amdRequire[name] = req[name];
amdRequire.amd = amdRequireFactory.amd;
amdRequire.config = function() {/* config is ignored, use webpack options */};
return amdRequire;
req.e(chunk, function() {
var modules = requiresFn();
if(fn)
return fn.apply(null, modules);
});
}
amdRequireFactory.amd = {};
module.exports = amdRequireFactory;
for(var name in req)
amdRequire[name] = req[name];
amdRequire.amd = {};
amdRequire.config = function() {/* config is ignored, use webpack options */};
module.exports = amdRequire;


/******/},
/******/
Expand Down Expand Up @@ -187,15 +185,14 @@ module.exports = function() {
## Uncompressed

```
Hash: 134fe0606e3405dceb34be6f6ce6778f
Compile Time: 50ms
Hash: b83e1a10c24b65db5ee14c7bcf8ebc85
Compile Time: 47ms
Chunks: 2
Modules: 7
Modules including duplicates: 7
Modules per chunk: 3.5
Modules first chunk: 3
output.js: 3779 characters
1.output.js: 1105 characters
main output.js: 3673 chars/bytes
1 1.output.js: 1105 chars/bytes
<id> <size> <filename>
<reason> from <filename>
Expand All @@ -204,7 +201,7 @@ output.js
main
1 516 (webpack)\buildin\__webpack_console.js
require (2x) from .\example.js
2 534 (webpack)\buildin\__webpack_amd_require.js
2 437 (webpack)\buildin\__webpack_amd_require.js
require (1x) from .\example.js
1.output.js
3 300 [context] (webpack)\examples\require.context\templates
Expand All @@ -220,15 +217,14 @@ output.js
## Minimized (uglify-js, no zip)

```
Hash: dbaccee5445c04556a63b1b0f35809e0
Compile Time: 134ms
Hash: 7da1af67af62fe871b1f6a446eee7c04
Compile Time: 168ms
Chunks: 2
Modules: 7
Modules including duplicates: 7
Modules per chunk: 3.5
Modules first chunk: 3
output.js: 1406 characters
1.output.js: 473 characters
main output.js: 1386 chars/bytes
1 1.output.js: 473 chars/bytes
<id> <size> <filename>
<reason> from <filename>
Expand All @@ -237,7 +233,7 @@ output.js
main
1 402 (webpack)\buildin\__webpack_console.js
require (2x) from .\example.js
2 264 (webpack)\buildin\__webpack_amd_require.js
2 253 (webpack)\buildin\__webpack_amd_require.js
require (1x) from .\example.js
1.output.js
3 228 [context] (webpack)\examples\require.context\templates
Expand Down
14 changes: 6 additions & 8 deletions examples/code-splitted-require.context/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,13 @@ module.exports = function() {

```
Hash: 1782c323238112211ad2f04896d358db
Compile Time: 39ms
Compile Time: 38ms
Chunks: 2
Modules: 6
Modules including duplicates: 6
Modules per chunk: 3
Modules first chunk: 2
output.js: 3041 characters
1.output.js: 1105 characters
main output.js: 3041 chars/bytes
1 1.output.js: 1105 chars/bytes
<id> <size> <filename>
<reason> from <filename>
Expand All @@ -192,14 +191,13 @@ output.js

```
Hash: 26040949e1e15270899471a6db72d142
Compile Time: 120ms
Compile Time: 135ms
Chunks: 2
Modules: 6
Modules including duplicates: 6
Modules per chunk: 3
Modules first chunk: 2
output.js: 1161 characters
1.output.js: 473 characters
main output.js: 1161 chars/bytes
1 1.output.js: 473 chars/bytes
<id> <size> <filename>
<reason> from <filename>
Expand Down
18 changes: 8 additions & 10 deletions examples/code-splitting-bundle-loader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,13 @@ module.exports = "It works";

```
Hash: 666de730e77865c0f918eb2d4b2418dc
Compile Time: 55ms
Compile Time: 53ms
Chunks: 2
Modules: 4
Modules including duplicates: 4
Modules per chunk: 2
Modules first chunk: 3
output.js: 3296 characters
1.output.js: 156 characters
main output.js: 3296 chars/bytes
1 1.output.js: 156 chars/bytes
<id> <size> <filename>
<reason> from <filename>
Expand All @@ -159,21 +158,20 @@ output.js
require (1x) from .\example.js
1.output.js
3 28 .\file.js
async require (1x) from .\file.js
async require (1x) from (webpack)\~\bundle-loader!.\file.js
```

## Minimized (uglify-js, no zip)

```
Hash: d3a59169e3ef602b7e54516f7ac8f25c
Compile Time: 129ms
Compile Time: 144ms
Chunks: 2
Modules: 4
Modules including duplicates: 4
Modules per chunk: 2
Modules first chunk: 3
output.js: 1228 characters
1.output.js: 57 characters
main output.js: 1228 chars/bytes
1 1.output.js: 57 chars/bytes
<id> <size> <filename>
<reason> from <filename>
Expand All @@ -186,5 +184,5 @@ output.js
require (1x) from .\example.js
1.output.js
3 25 .\file.js
async require (1x) from .\file.js
async require (1x) from (webpack)\~\bundle-loader!.\file.js
```
33 changes: 7 additions & 26 deletions examples/code-splitting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,24 +92,7 @@ require.e(1, function(require) {
# js/1.output.js

``` javascript
/******/webpackJsonp(1, {
/******/3: function(module, exports, require) {

/*** .\~\c.js ***/

// module c

/******/},
/******/
/******/4: function(module, exports, require) {

/*** .\~\d.js ***/

// module d

/******/},
/******/
/******/})
webpackJsonp(1,{3:function(a,b,c){},4:function(a,b,c){}})
```

Minimized
Expand All @@ -124,14 +107,13 @@ webpackJsonp(1,{3:function(a,b,c){},4:function(a,b,c){}})

```
Hash: 50d0702166fd38f26c96b9cd8d421243
Compile Time: 54ms
Compile Time: 45ms
Chunks: 2
Modules: 5
Modules including duplicates: 5
Modules per chunk: 2.5
Modules first chunk: 3
output.js: 2340 characters
1.output.js: 240 characters
main output.js: 2340 chars/bytes
1 1.output.js: 240 chars/bytes
<id> <size> <filename>
<reason> from <filename>
Expand All @@ -153,14 +135,13 @@ output.js

```
Hash: cfe028c1c8ac12be33bebd83dc12aa80
Compile Time: 113ms
Compile Time: 141ms
Chunks: 2
Modules: 5
Modules including duplicates: 5
Modules per chunk: 2.5
Modules first chunk: 3
output.js: 786 characters
1.output.js: 57 characters
main output.js: 786 chars/bytes
1 1.output.js: 57 chars/bytes
<id> <size> <filename>
<reason> from <filename>
Expand Down
18 changes: 8 additions & 10 deletions examples/coffee-script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,12 @@ console.timeEnd = function() {

```
Hash: 474013c0b0bff5edce1407a1cb805a35
Compile Time: 168ms
Compile Time: 137ms
Chunks: 1
Modules: 4
Modules including duplicates: 4
Modules per chunk: 4
Modules first chunk: 4
output.js: 2407 characters
main output.js: 2407 chars/bytes
<id> <size> <filename>
<reason> from <filename>
Expand All @@ -140,9 +139,9 @@ output.js
main
1 516 (webpack)\buildin\__webpack_console.js
require (1x) from .\example.js
require (1x) from .\cup2.coffee
require (1x) from (webpack)\~\coffee-loader!.\cup2.coffee
2 92 (webpack)\~\coffee-loader!.\cup2.coffee
require (2x) from .\cup1.coffee
require (2x) from (webpack)\~\coffee-loader!.\cup1.coffee
3 178 (webpack)\~\coffee-loader!.\cup1.coffee
require (1x) from .\example.js
```
Expand All @@ -151,13 +150,12 @@ output.js

```
Hash: 19d4c8993b53d92be00e044dd3101c86
Compile Time: 230ms
Compile Time: 219ms
Chunks: 1
Modules: 4
Modules including duplicates: 4
Modules per chunk: 4
Modules first chunk: 4
output.js: 891 characters
main output.js: 891 chars/bytes
<id> <size> <filename>
<reason> from <filename>
Expand All @@ -166,9 +164,9 @@ output.js
main
1 402 (webpack)\buildin\__webpack_console.js
require (1x) from .\example.js
require (1x) from .\cup2.coffee
require (1x) from (webpack)\~\coffee-loader!.\cup2.coffee
2 76 (webpack)\~\coffee-loader!.\cup2.coffee
require (2x) from .\cup1.coffee
require (2x) from (webpack)\~\coffee-loader!.\cup1.coffee
3 101 (webpack)\~\coffee-loader!.\cup1.coffee
require (1x) from .\example.js
```
8 changes: 3 additions & 5 deletions examples/commonjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ Compile Time: 23ms
Chunks: 1
Modules: 3
Modules including duplicates: 3
Modules per chunk: 3
Modules first chunk: 3
output.js: 1455 characters
main output.js: 1455 chars/bytes
<id> <size> <filename>
<reason> from <filename>
Expand All @@ -121,13 +120,12 @@ output.js

```
Hash: e7fbffd3f8f8581e96fa46569eda7c02
Compile Time: 74ms
Compile Time: 94ms
Chunks: 1
Modules: 3
Modules including duplicates: 3
Modules per chunk: 3
Modules first chunk: 3
output.js: 510 characters
main output.js: 510 chars/bytes
<id> <size> <filename>
<reason> from <filename>
Expand Down
Loading

0 comments on commit 0fb1fa8

Please sign in to comment.