added dll example with module

This commit is contained in:
Tobias Koppers 2015-10-13 16:19:11 +02:00
parent 9f440e30ec
commit 25072223a0
5 changed files with 82 additions and 52 deletions

View File

@ -25,6 +25,8 @@ console.log(require("../dll/a"));
console.log(require("beta/beta"));
console.log(require("beta/b"));
console.log(require("module"));
```
# js/output.js
@ -85,11 +87,13 @@ console.log(require("beta/b"));
console.log(__webpack_require__(/*! beta/beta */ 4));
console.log(__webpack_require__(/*! beta/b */ 6));
console.log(__webpack_require__(/*! module */ 7));
/***/ },
/* 1 */
/*!**************************************************************************!*\
!*** delegated ./alpha.js from dll-reference alpha_fda802f3c408a66ef744 ***!
!*** delegated ./alpha.js from dll-reference alpha_fdf65b7c8f44aa643c94 ***!
\**************************************************************************/
/***/ function(module, exports, __webpack_require__) {
@ -98,16 +102,16 @@ console.log(require("beta/b"));
/***/ },
/* 2 */
/*!*********************************************!*\
!*** external "alpha_fda802f3c408a66ef744" ***!
!*** external "alpha_fdf65b7c8f44aa643c94" ***!
\*********************************************/
/***/ function(module, exports) {
module.exports = alpha_fda802f3c408a66ef744;
module.exports = alpha_fdf65b7c8f44aa643c94;
/***/ },
/* 3 */
/*!**********************************************************************!*\
!*** delegated ./a.js from dll-reference alpha_fda802f3c408a66ef744 ***!
!*** delegated ./a.js from dll-reference alpha_fdf65b7c8f44aa643c94 ***!
\**********************************************************************/
/***/ function(module, exports, __webpack_require__) {
@ -116,29 +120,38 @@ console.log(require("beta/b"));
/***/ },
/* 4 */
/*!************************************************************************!*\
!*** delegated ./beta.js from dll-reference beta_fda802f3c408a66ef744 ***!
!*** delegated ./beta.js from dll-reference beta_fdf65b7c8f44aa643c94 ***!
\************************************************************************/
/***/ function(module, exports, __webpack_require__) {
module.exports = (__webpack_require__(5))(3);
module.exports = (__webpack_require__(5))(4);
/***/ },
/* 5 */
/*!********************************************!*\
!*** external "beta_fda802f3c408a66ef744" ***!
!*** external "beta_fdf65b7c8f44aa643c94" ***!
\********************************************/
/***/ function(module, exports) {
module.exports = beta_fda802f3c408a66ef744;
module.exports = beta_fdf65b7c8f44aa643c94;
/***/ },
/* 6 */
/*!*********************************************************************!*\
!*** delegated ./b.js from dll-reference beta_fda802f3c408a66ef744 ***!
!*** delegated ./b.js from dll-reference beta_fdf65b7c8f44aa643c94 ***!
\*********************************************************************/
/***/ function(module, exports, __webpack_require__) {
module.exports = (__webpack_require__(5))(4);
module.exports = (__webpack_require__(5))(5);
/***/ },
/* 7 */
/*!*****************************************************************************************!*\
!*** delegated ../node_modules/module.js from dll-reference alpha_fdf65b7c8f44aa643c94 ***!
\*****************************************************************************************/
/***/ function(module, exports, __webpack_require__) {
module.exports = (__webpack_require__(2))(3);
/***/ }
/******/ ]);
@ -149,27 +162,27 @@ console.log(require("beta/b"));
## Uncompressed
```
Hash: 0d8279ed7b443d36b536
Version: webpack 1.9.10
Time: 78ms
Hash: 1ec5dd5375620450fa42
Version: webpack 1.12.2
Time: 126ms
Asset Size Chunks Chunk Names
output.js 3.62 kB 0 [emitted] main
chunk {0} output.js (main) 397 bytes [rendered]
output.js 4.08 kB 0 [emitted] main
chunk {0} output.js (main) 474 bytes [rendered]
> main [0] ./example.js
[0] ./example.js 145 bytes {0} [built]
+ 6 hidden modules
[0] ./example.js 180 bytes {0} [built]
+ 7 hidden modules
```
## Minimized (uglify-js, no zip)
```
Hash: 1e9d431b3cebd3bcea12
Version: webpack 1.9.10
Time: 201ms
Hash: 027c2207d2b3e0dfd65e
Version: webpack 1.12.2
Time: 268ms
Asset Size Chunks Chunk Names
output.js 537 bytes 0 [emitted] main
chunk {0} output.js (main) 397 bytes [rendered]
output.js 590 bytes 0 [emitted] main
chunk {0} output.js (main) 474 bytes [rendered]
> main [0] ./example.js
[0] ./example.js 145 bytes {0} [built]
+ 6 hidden modules
[0] ./example.js 180 bytes {0} [built]
+ 7 hidden modules
```

View File

@ -3,3 +3,5 @@ console.log(require("../dll/a"));
console.log(require("beta/beta"));
console.log(require("beta/b"));
console.log(require("module"));

View File

@ -5,7 +5,7 @@ var path = require("path");
var webpack = require("../../");
module.exports = {
entry: {
alpha: ["./alpha", "./a"],
alpha: ["./alpha", "./a", "module"],
beta: ["./beta", "./b"]
},
output: {
@ -25,7 +25,7 @@ module.exports = {
# js/MyDll.alpha.js
``` javascript
var alpha_fda802f3c408a66ef744 =
var alpha_fdf65b7c8f44aa643c94 =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
@ -95,6 +95,15 @@ var alpha_fda802f3c408a66ef744 =
module.exports = "a";
/***/ },
/* 3 */
/*!**********************!*\
!*** ../~/module.js ***!
\**********************/
/***/ function(module, exports) {
module.exports = "module";
/***/ }
/******/ ]);
```
@ -103,10 +112,11 @@ var alpha_fda802f3c408a66ef744 =
``` javascript
{
"name": "alpha_fda802f3c408a66ef744",
"name": "alpha_fdf65b7c8f44aa643c94",
"content": {
"./alpha.js": 1,
"./a.js": 2
"./a.js": 2,
"../node_modules/module.js": 3
}
}
```
@ -116,49 +126,53 @@ var alpha_fda802f3c408a66ef744 =
## Uncompressed
```
Hash: fda802f3c408a66ef744
Version: webpack 1.9.10
Time: 69ms
Hash: fdf65b7c8f44aa643c94
Version: webpack 1.12.2
Time: 116ms
Asset Size Chunks Chunk Names
MyDll.alpha.js 1.84 kB 0 [emitted] alpha
MyDll.alpha.js 2 kB 0 [emitted] alpha
MyDll.beta.js 1.85 kB 1 [emitted] beta
chunk {0} MyDll.alpha.js (alpha) 58 bytes [rendered]
chunk {0} MyDll.alpha.js (alpha) 84 bytes [rendered]
> alpha [0] dll alpha
[0] dll alpha 12 bytes {0} [built]
[1] ./alpha.js 25 bytes {0} [built]
single entry ./alpha [0] dll alpha
[2] ./a.js 21 bytes {0} [built]
single entry ./a [0] dll alpha
[3] ../~/module.js 26 bytes {0} [built]
single entry module [0] dll alpha
chunk {1} MyDll.beta.js (beta) 57 bytes [rendered]
> beta [0] dll beta
[0] dll beta 12 bytes {1} [built]
[3] ./beta.js 24 bytes {1} [built]
[4] ./beta.js 24 bytes {1} [built]
single entry ./beta [0] dll beta
[4] ./b.js 21 bytes {1} [built]
[5] ./b.js 21 bytes {1} [built]
single entry ./b [0] dll beta
```
## Minimized (uglify-js, no zip)
```
Hash: 28b01778c3ed267edad7
Version: webpack 1.9.10
Time: 173ms
Hash: 280629f3235a1e77e95f
Version: webpack 1.12.2
Time: 267ms
Asset Size Chunks Chunk Names
MyDll.beta.js 326 bytes 0 [emitted] beta
MyDll.alpha.js 326 bytes 1 [emitted] alpha
chunk {0} MyDll.beta.js (beta) 57 bytes [rendered]
> beta [0] dll beta
[0] dll beta 12 bytes {0} [built]
[3] ./b.js 21 bytes {0} [built]
single entry ./b [0] dll beta
[4] ./beta.js 24 bytes {0} [built]
single entry ./beta [0] dll beta
chunk {1} MyDll.alpha.js (alpha) 58 bytes [rendered]
MyDll.alpha.js 362 bytes 0 [emitted] alpha
MyDll.beta.js 326 bytes 1 [emitted] beta
chunk {0} MyDll.alpha.js (alpha) 84 bytes [rendered]
> alpha [0] dll alpha
[0] dll alpha 12 bytes {1} [built]
[1] ./a.js 21 bytes {1} [built]
[0] dll alpha 12 bytes {0} [built]
[1] ./a.js 21 bytes {0} [built]
single entry ./a [0] dll alpha
[2] ./alpha.js 25 bytes {1} [built]
[2] ./alpha.js 25 bytes {0} [built]
single entry ./alpha [0] dll alpha
[5] ../~/module.js 26 bytes {0} [built]
single entry module [0] dll alpha
chunk {1} MyDll.beta.js (beta) 57 bytes [rendered]
> beta [0] dll beta
[0] dll beta 12 bytes {1} [built]
[3] ./b.js 21 bytes {1} [built]
single entry ./b [0] dll beta
[4] ./beta.js 24 bytes {1} [built]
single entry ./beta [0] dll beta
```

View File

@ -2,7 +2,7 @@ var path = require("path");
var webpack = require("../../");
module.exports = {
entry: {
alpha: ["./alpha", "./a"],
alpha: ["./alpha", "./a", "module"],
beta: ["./beta", "./b"]
},
output: {

1
examples/node_modules/module.js generated vendored Normal file
View File

@ -0,0 +1 @@
module.exports = "module";