Skip to content

Commit 2507222

Browse files
committed
added dll example with module
1 parent 9f440e3 commit 2507222

5 files changed

Lines changed: 82 additions & 52 deletions

File tree

examples/dll-user/README.md

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ console.log(require("../dll/a"));
2525

2626
console.log(require("beta/beta"));
2727
console.log(require("beta/b"));
28+
29+
console.log(require("module"));
2830
```
2931

3032
# js/output.js
@@ -85,11 +87,13 @@ console.log(require("beta/b"));
8587
console.log(__webpack_require__(/*! beta/beta */ 4));
8688
console.log(__webpack_require__(/*! beta/b */ 6));
8789

90+
console.log(__webpack_require__(/*! module */ 7));
91+
8892

8993
/***/ },
9094
/* 1 */
9195
/*!**************************************************************************!*\
92-
!*** delegated ./alpha.js from dll-reference alpha_fda802f3c408a66ef744 ***!
96+
!*** delegated ./alpha.js from dll-reference alpha_fdf65b7c8f44aa643c94 ***!
9397
\**************************************************************************/
9498
/***/ function(module, exports, __webpack_require__) {
9599

@@ -98,16 +102,16 @@ console.log(require("beta/b"));
98102
/***/ },
99103
/* 2 */
100104
/*!*********************************************!*\
101-
!*** external "alpha_fda802f3c408a66ef744" ***!
105+
!*** external "alpha_fdf65b7c8f44aa643c94" ***!
102106
\*********************************************/
103107
/***/ function(module, exports) {
104108

105-
module.exports = alpha_fda802f3c408a66ef744;
109+
module.exports = alpha_fdf65b7c8f44aa643c94;
106110

107111
/***/ },
108112
/* 3 */
109113
/*!**********************************************************************!*\
110-
!*** delegated ./a.js from dll-reference alpha_fda802f3c408a66ef744 ***!
114+
!*** delegated ./a.js from dll-reference alpha_fdf65b7c8f44aa643c94 ***!
111115
\**********************************************************************/
112116
/***/ function(module, exports, __webpack_require__) {
113117

@@ -116,29 +120,38 @@ console.log(require("beta/b"));
116120
/***/ },
117121
/* 4 */
118122
/*!************************************************************************!*\
119-
!*** delegated ./beta.js from dll-reference beta_fda802f3c408a66ef744 ***!
123+
!*** delegated ./beta.js from dll-reference beta_fdf65b7c8f44aa643c94 ***!
120124
\************************************************************************/
121125
/***/ function(module, exports, __webpack_require__) {
122126

123-
module.exports = (__webpack_require__(5))(3);
127+
module.exports = (__webpack_require__(5))(4);
124128

125129
/***/ },
126130
/* 5 */
127131
/*!********************************************!*\
128-
!*** external "beta_fda802f3c408a66ef744" ***!
132+
!*** external "beta_fdf65b7c8f44aa643c94" ***!
129133
\********************************************/
130134
/***/ function(module, exports) {
131135

132-
module.exports = beta_fda802f3c408a66ef744;
136+
module.exports = beta_fdf65b7c8f44aa643c94;
133137

134138
/***/ },
135139
/* 6 */
136140
/*!*********************************************************************!*\
137-
!*** delegated ./b.js from dll-reference beta_fda802f3c408a66ef744 ***!
141+
!*** delegated ./b.js from dll-reference beta_fdf65b7c8f44aa643c94 ***!
138142
\*********************************************************************/
139143
/***/ function(module, exports, __webpack_require__) {
140144

141-
module.exports = (__webpack_require__(5))(4);
145+
module.exports = (__webpack_require__(5))(5);
146+
147+
/***/ },
148+
/* 7 */
149+
/*!*****************************************************************************************!*\
150+
!*** delegated ../node_modules/module.js from dll-reference alpha_fdf65b7c8f44aa643c94 ***!
151+
\*****************************************************************************************/
152+
/***/ function(module, exports, __webpack_require__) {
153+
154+
module.exports = (__webpack_require__(2))(3);
142155

143156
/***/ }
144157
/******/ ]);
@@ -149,27 +162,27 @@ console.log(require("beta/b"));
149162
## Uncompressed
150163

151164
```
152-
Hash: 0d8279ed7b443d36b536
153-
Version: webpack 1.9.10
154-
Time: 78ms
165+
Hash: 1ec5dd5375620450fa42
166+
Version: webpack 1.12.2
167+
Time: 126ms
155168
Asset Size Chunks Chunk Names
156-
output.js 3.62 kB 0 [emitted] main
157-
chunk {0} output.js (main) 397 bytes [rendered]
169+
output.js 4.08 kB 0 [emitted] main
170+
chunk {0} output.js (main) 474 bytes [rendered]
158171
> main [0] ./example.js
159-
[0] ./example.js 145 bytes {0} [built]
160-
+ 6 hidden modules
172+
[0] ./example.js 180 bytes {0} [built]
173+
+ 7 hidden modules
161174
```
162175

163176
## Minimized (uglify-js, no zip)
164177

165178
```
166-
Hash: 1e9d431b3cebd3bcea12
167-
Version: webpack 1.9.10
168-
Time: 201ms
179+
Hash: 027c2207d2b3e0dfd65e
180+
Version: webpack 1.12.2
181+
Time: 268ms
169182
Asset Size Chunks Chunk Names
170-
output.js 537 bytes 0 [emitted] main
171-
chunk {0} output.js (main) 397 bytes [rendered]
183+
output.js 590 bytes 0 [emitted] main
184+
chunk {0} output.js (main) 474 bytes [rendered]
172185
> main [0] ./example.js
173-
[0] ./example.js 145 bytes {0} [built]
174-
+ 6 hidden modules
186+
[0] ./example.js 180 bytes {0} [built]
187+
+ 7 hidden modules
175188
```

examples/dll-user/example.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ console.log(require("../dll/a"));
33

44
console.log(require("beta/beta"));
55
console.log(require("beta/b"));
6+
7+
console.log(require("module"));

examples/dll/README.md

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var path = require("path");
55
var webpack = require("../../");
66
module.exports = {
77
entry: {
8-
alpha: ["./alpha", "./a"],
8+
alpha: ["./alpha", "./a", "module"],
99
beta: ["./beta", "./b"]
1010
},
1111
output: {
@@ -25,7 +25,7 @@ module.exports = {
2525
# js/MyDll.alpha.js
2626

2727
``` javascript
28-
var alpha_fda802f3c408a66ef744 =
28+
var alpha_fdf65b7c8f44aa643c94 =
2929
/******/ (function(modules) { // webpackBootstrap
3030
/******/ // The module cache
3131
/******/ var installedModules = {};
@@ -95,6 +95,15 @@ var alpha_fda802f3c408a66ef744 =
9595

9696
module.exports = "a";
9797

98+
/***/ },
99+
/* 3 */
100+
/*!**********************!*\
101+
!*** ../~/module.js ***!
102+
\**********************/
103+
/***/ function(module, exports) {
104+
105+
module.exports = "module";
106+
98107
/***/ }
99108
/******/ ]);
100109
```
@@ -103,10 +112,11 @@ var alpha_fda802f3c408a66ef744 =
103112

104113
``` javascript
105114
{
106-
"name": "alpha_fda802f3c408a66ef744",
115+
"name": "alpha_fdf65b7c8f44aa643c94",
107116
"content": {
108117
"./alpha.js": 1,
109-
"./a.js": 2
118+
"./a.js": 2,
119+
"../node_modules/module.js": 3
110120
}
111121
}
112122
```
@@ -116,49 +126,53 @@ var alpha_fda802f3c408a66ef744 =
116126
## Uncompressed
117127

118128
```
119-
Hash: fda802f3c408a66ef744
120-
Version: webpack 1.9.10
121-
Time: 69ms
129+
Hash: fdf65b7c8f44aa643c94
130+
Version: webpack 1.12.2
131+
Time: 116ms
122132
Asset Size Chunks Chunk Names
123-
MyDll.alpha.js 1.84 kB 0 [emitted] alpha
133+
MyDll.alpha.js 2 kB 0 [emitted] alpha
124134
MyDll.beta.js 1.85 kB 1 [emitted] beta
125-
chunk {0} MyDll.alpha.js (alpha) 58 bytes [rendered]
135+
chunk {0} MyDll.alpha.js (alpha) 84 bytes [rendered]
126136
> alpha [0] dll alpha
127137
[0] dll alpha 12 bytes {0} [built]
128138
[1] ./alpha.js 25 bytes {0} [built]
129139
single entry ./alpha [0] dll alpha
130140
[2] ./a.js 21 bytes {0} [built]
131141
single entry ./a [0] dll alpha
142+
[3] ../~/module.js 26 bytes {0} [built]
143+
single entry module [0] dll alpha
132144
chunk {1} MyDll.beta.js (beta) 57 bytes [rendered]
133145
> beta [0] dll beta
134146
[0] dll beta 12 bytes {1} [built]
135-
[3] ./beta.js 24 bytes {1} [built]
147+
[4] ./beta.js 24 bytes {1} [built]
136148
single entry ./beta [0] dll beta
137-
[4] ./b.js 21 bytes {1} [built]
149+
[5] ./b.js 21 bytes {1} [built]
138150
single entry ./b [0] dll beta
139151
```
140152

141153
## Minimized (uglify-js, no zip)
142154

143155
```
144-
Hash: 28b01778c3ed267edad7
145-
Version: webpack 1.9.10
146-
Time: 173ms
156+
Hash: 280629f3235a1e77e95f
157+
Version: webpack 1.12.2
158+
Time: 267ms
147159
Asset Size Chunks Chunk Names
148-
MyDll.beta.js 326 bytes 0 [emitted] beta
149-
MyDll.alpha.js 326 bytes 1 [emitted] alpha
150-
chunk {0} MyDll.beta.js (beta) 57 bytes [rendered]
151-
> beta [0] dll beta
152-
[0] dll beta 12 bytes {0} [built]
153-
[3] ./b.js 21 bytes {0} [built]
154-
single entry ./b [0] dll beta
155-
[4] ./beta.js 24 bytes {0} [built]
156-
single entry ./beta [0] dll beta
157-
chunk {1} MyDll.alpha.js (alpha) 58 bytes [rendered]
160+
MyDll.alpha.js 362 bytes 0 [emitted] alpha
161+
MyDll.beta.js 326 bytes 1 [emitted] beta
162+
chunk {0} MyDll.alpha.js (alpha) 84 bytes [rendered]
158163
> alpha [0] dll alpha
159-
[0] dll alpha 12 bytes {1} [built]
160-
[1] ./a.js 21 bytes {1} [built]
164+
[0] dll alpha 12 bytes {0} [built]
165+
[1] ./a.js 21 bytes {0} [built]
161166
single entry ./a [0] dll alpha
162-
[2] ./alpha.js 25 bytes {1} [built]
167+
[2] ./alpha.js 25 bytes {0} [built]
163168
single entry ./alpha [0] dll alpha
169+
[5] ../~/module.js 26 bytes {0} [built]
170+
single entry module [0] dll alpha
171+
chunk {1} MyDll.beta.js (beta) 57 bytes [rendered]
172+
> beta [0] dll beta
173+
[0] dll beta 12 bytes {1} [built]
174+
[3] ./b.js 21 bytes {1} [built]
175+
single entry ./b [0] dll beta
176+
[4] ./beta.js 24 bytes {1} [built]
177+
single entry ./beta [0] dll beta
164178
```

examples/dll/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var path = require("path");
22
var webpack = require("../../");
33
module.exports = {
44
entry: {
5-
alpha: ["./alpha", "./a"],
5+
alpha: ["./alpha", "./a", "module"],
66
beta: ["./beta", "./b"]
77
},
88
output: {

examples/node_modules/module.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)