Skip to content

Commit a2fdd75

Browse files
committed
updated examples
1 parent b5b5cc9 commit a2fdd75

15 files changed

Lines changed: 1342 additions & 1342 deletions

File tree

examples/code-splitted-require.context-amd/README.md

Lines changed: 126 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -17,107 +17,107 @@ getTemplate("b", function(b) {
1717
# js/output.js
1818

1919
``` javascript
20-
(function(modules) { // webpackBootstrap
21-
// The module cache
22-
var installedModules = {};
23-
24-
// object to store loaded and loading chunks
25-
// "0" means "already loaded"
26-
// Array means "loading", array contains callbacks
27-
var installedChunks = {0:0};
28-
29-
// The require function
30-
function require(moduleId) {
31-
// Check if module is in cache
32-
if(installedModules[moduleId])
33-
return installedModules[moduleId].exports;
34-
35-
// Create a new module (and put it into the cache)
36-
var module = installedModules[moduleId] = {
37-
exports: {},
38-
id: moduleId,
39-
loaded: false
40-
};
41-
42-
// Execute the module function
43-
modules[moduleId].call(null, module, module.exports, require);
44-
45-
// Flag the module as loaded
46-
module.loaded = true;
47-
48-
// Return the exports of the module
49-
return module.exports;
50-
}
51-
52-
// The bundle contains no chunks. A empty chunk loading function.
53-
require.e = function requireEnsure(chunkId, callback) {
54-
// "0" is the signal for "already loaded"
55-
if(installedChunks[chunkId] === 0)
56-
return callback.call(null, require);
57-
58-
// an array means "currently loading".
59-
if(installedChunks[chunkId] !== undefined) {
60-
installedChunks[chunkId].push(callback);
61-
} else {
62-
// start chunk loading
63-
installedChunks[chunkId] = [callback];
64-
var head = document.getElementsByTagName('head')[0];
65-
var script = document.createElement('script');
66-
script.type = 'text/javascript';
67-
script.charset = 'utf-8';
68-
script.src = modules.c + "" + chunkId + ".output.js";
69-
head.appendChild(script);
70-
}
71-
};
72-
73-
// expose the modules object (__webpack_modules__)
74-
require.modules = modules;
75-
76-
// expose the module cache
77-
require.cache = installedModules;
78-
79-
// install a JSONP callback for chunk loading
80-
window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) {
81-
// add "moreModules" to the modules object,
82-
// then flag all "chunkIds" as loaded and fire callback
83-
var moduleId, chunkId, callbacks = [];
84-
while(chunkIds.length) {
85-
chunkId = chunkIds.shift();
86-
if(installedChunks[chunkId])
87-
callbacks.push.apply(callbacks, installedChunks[chunkId]);
88-
installedChunks[chunkId] = 0;
89-
}
90-
for(moduleId in moreModules)
91-
modules[moduleId] = moreModules[moduleId];
92-
while(callbacks.length)
93-
callbacks.shift().call(null, require);
94-
};
95-
96-
// Load entry module and return exports
97-
return require(0);
98-
})
20+
/******/(function(modules) { // webpackBootstrap
21+
/******/ // The module cache
22+
/******/ var installedModules = {};
23+
/******/
24+
/******/ // object to store loaded and loading chunks
25+
/******/ // "0" means "already loaded"
26+
/******/ // Array means "loading", array contains callbacks
27+
/******/ var installedChunks = {0:0};
28+
/******/
29+
/******/ // The require function
30+
/******/ function require(moduleId) {
31+
/******/ // Check if module is in cache
32+
/******/ if(installedModules[moduleId])
33+
/******/ return installedModules[moduleId].exports;
34+
/******/
35+
/******/ // Create a new module (and put it into the cache)
36+
/******/ var module = installedModules[moduleId] = {
37+
/******/ exports: {},
38+
/******/ id: moduleId,
39+
/******/ loaded: false
40+
/******/ };
41+
/******/
42+
/******/ // Execute the module function
43+
/******/ modules[moduleId].call(null, module, module.exports, require);
44+
/******/
45+
/******/ // Flag the module as loaded
46+
/******/ module.loaded = true;
47+
/******/
48+
/******/ // Return the exports of the module
49+
/******/ return module.exports;
50+
/******/ }
51+
/******/
52+
/******/ // The bundle contains no chunks. A empty chunk loading function.
53+
/******/ require.e = function requireEnsure(chunkId, callback) {
54+
/******/ // "0" is the signal for "already loaded"
55+
/******/ if(installedChunks[chunkId] === 0)
56+
/******/ return callback.call(null, require);
57+
/******/
58+
/******/ // an array means "currently loading".
59+
/******/ if(installedChunks[chunkId] !== undefined) {
60+
/******/ installedChunks[chunkId].push(callback);
61+
/******/ } else {
62+
/******/ // start chunk loading
63+
/******/ installedChunks[chunkId] = [callback];
64+
/******/ var head = document.getElementsByTagName('head')[0];
65+
/******/ var script = document.createElement('script');
66+
/******/ script.type = 'text/javascript';
67+
/******/ script.charset = 'utf-8';
68+
/******/ script.src = modules.c + "" + chunkId + ".output.js";
69+
/******/ head.appendChild(script);
70+
/******/ }
71+
/******/ };
72+
/******/
73+
/******/ // expose the modules object (__webpack_modules__)
74+
/******/ require.modules = modules;
75+
/******/
76+
/******/ // expose the module cache
77+
/******/ require.cache = installedModules;
78+
/******/
79+
/******/ // install a JSONP callback for chunk loading
80+
/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) {
81+
/******/ // add "moreModules" to the modules object,
82+
/******/ // then flag all "chunkIds" as loaded and fire callback
83+
/******/ var moduleId, chunkId, callbacks = [];
84+
/******/ while(chunkIds.length) {
85+
/******/ chunkId = chunkIds.shift();
86+
/******/ if(installedChunks[chunkId])
87+
/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]);
88+
/******/ installedChunks[chunkId] = 0;
89+
/******/ }
90+
/******/ for(moduleId in moreModules)
91+
/******/ modules[moduleId] = moreModules[moduleId];
92+
/******/ while(callbacks.length)
93+
/******/ callbacks.shift().call(null, require);
94+
/******/ };
95+
/******/
96+
/******/ // Load entry module and return exports
97+
/******/ return require(0);
98+
/******/})
9999
/************************************************************************/
100100
({
101101
// __webpack_public_path__
102-
103102
c: "",
103+
104104
/***/ 0:
105105
/*!********************!*\
106106
!*** ./example.js ***!
107107
\********************/
108108
/***/ function(module, exports, require) {
109109

110-
function getTemplate(templateName, callback) {
111-
require.e/* require */(1, function(require) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [require(/*! ../require.context/templates */ 1)("./"+templateName)]; (function(tmpl) {
112-
callback(tmpl());
113-
}.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));});
114-
}
115-
getTemplate("a", function(a) {
116-
console.log(a);
117-
});
118-
getTemplate("b", function(b) {
119-
console.log(b);
120-
});
110+
function getTemplate(templateName, callback) {
111+
require.e/* require */(1, function(require) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [require(/*! ../require.context/templates */ 1)("./"+templateName)]; (function(tmpl) {
112+
callback(tmpl());
113+
}.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));});
114+
}
115+
getTemplate("a", function(a) {
116+
console.log(a);
117+
});
118+
getTemplate("b", function(b) {
119+
console.log(b);
120+
});
121121

122122
/***/ }
123123
})
@@ -135,26 +135,26 @@ webpackJsonp([1],
135135
\*********************************************/
136136
/***/ function(module, exports, require) {
137137

138-
var map = {
139-
"./a": 2,
140-
"./a.js": 2,
141-
"./b": 3,
142-
"./b.js": 3,
143-
"./c": 4,
144-
"./c.js": 4
145-
};
146-
function webpackContext(req) {
147-
return require(webpackContextResolve(req));
148-
};
149-
function webpackContextResolve(req) {
150-
return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }());
151-
};
152-
webpackContext.keys = function webpackContextKeys() {
153-
return Object.keys(map);
154-
};
155-
webpackContext.resolve = webpackContextResolve;
156-
module.exports = webpackContext;
157-
138+
var map = {
139+
"./a": 2,
140+
"./a.js": 2,
141+
"./b": 3,
142+
"./b.js": 3,
143+
"./c": 4,
144+
"./c.js": 4
145+
};
146+
function webpackContext(req) {
147+
return require(webpackContextResolve(req));
148+
};
149+
function webpackContextResolve(req) {
150+
return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }());
151+
};
152+
webpackContext.keys = function webpackContextKeys() {
153+
return Object.keys(map);
154+
};
155+
webpackContext.resolve = webpackContextResolve;
156+
module.exports = webpackContext;
157+
158158

159159
/***/ },
160160

@@ -164,9 +164,9 @@ module.exports = webpackContext;
164164
\*****************************************/
165165
/***/ function(module, exports, require) {
166166

167-
module.exports = function() {
168-
return "This text was generated by template A";
169-
}
167+
module.exports = function() {
168+
return "This text was generated by template A";
169+
}
170170

171171
/***/ },
172172

@@ -176,9 +176,9 @@ module.exports = function() {
176176
\*****************************************/
177177
/***/ function(module, exports, require) {
178178

179-
module.exports = function() {
180-
return "This text was generated by template B";
181-
}
179+
module.exports = function() {
180+
return "This text was generated by template B";
181+
}
182182

183183
/***/ },
184184

@@ -188,9 +188,9 @@ module.exports = function() {
188188
\*****************************************/
189189
/***/ function(module, exports, require) {
190190

191-
module.exports = function() {
192-
return "This text was generated by template C";
193-
}
191+
module.exports = function() {
192+
return "This text was generated by template C";
193+
}
194194

195195
/***/ }
196196

@@ -204,11 +204,11 @@ module.exports = function() {
204204

205205
```
206206
Hash: 7a6425e8fe46dc01a0db9eee1a97caca
207-
Version: webpack 0.10.0-beta3
208-
Time: 56ms
207+
Version: webpack 0.10.0-beta4
208+
Time: 54ms
209209
Asset Size Chunks Chunk Names
210-
output.js 3016 0 main
211-
1.output.js 1567 1
210+
output.js 3659 0 main
211+
1.output.js 1596 1
212212
chunk {0} output.js (main) 261
213213
[0] ./example.js 261 [built] {0}
214214
chunk {1} 1.output.js 463 {0}
@@ -229,8 +229,8 @@ chunk {1} 1.output.js 463 {0}
229229

230230
```
231231
Hash: 7a6425e8fe46dc01a0db9eee1a97caca
232-
Version: webpack 0.10.0-beta3
233-
Time: 170ms
232+
Version: webpack 0.10.0-beta4
233+
Time: 169ms
234234
Asset Size Chunks Chunk Names
235235
output.js 831 0 main
236236
1.output.js 531 1

0 commit comments

Comments
 (0)