From 780c17e202865abc541b8ae9ac33a1320fa19efe Mon Sep 17 00:00:00 2001 From: Steven Hargrove Date: Fri, 25 Jan 2019 13:15:34 +0100 Subject: [PATCH] fix side-effects example --- examples/side-effects/README.md | 85 ++++++++----------------- examples/side-effects/webpack.config.js | 5 ++ 2 files changed, 30 insertions(+), 60 deletions(-) create mode 100644 examples/side-effects/webpack.config.js diff --git a/examples/side-effects/README.md b/examples/side-effects/README.md index 83da314c651..f3c33af5a0a 100644 --- a/examples/side-effects/README.md +++ b/examples/side-effects/README.md @@ -158,8 +158,9 @@ export { c } from "./c"; "use strict"; __webpack_require__.r(__webpack_exports__); -/* harmony import */ var big_module__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! big-module */ 1); -/* harmony import */ var big_module_with_flag__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! big-module-with-flag */ 5); +/* harmony import */ var big_module__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! big-module */ 3); +/* harmony import */ var big_module_with_flag__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! big-module-with-flag */ 7); +/* harmony import */ var big_module_with_flag__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! big-module-with-flag */ 8); @@ -167,12 +168,14 @@ console.log( big_module__WEBPACK_IMPORTED_MODULE_0__["a"], big_module__WEBPACK_IMPORTED_MODULE_0__["b"], big_module_with_flag__WEBPACK_IMPORTED_MODULE_1__["a"], - big_module_with_flag__WEBPACK_IMPORTED_MODULE_1__["b"] + big_module_with_flag__WEBPACK_IMPORTED_MODULE_2__["b"] ); /***/ }), -/* 1 */ +/* 1 */, +/* 2 */, +/* 3 */ /*!******************************************!*\ !*** ./node_modules/big-module/index.js ***! \******************************************/ @@ -181,13 +184,13 @@ console.log( "use strict"; __webpack_require__.r(__webpack_exports__); -/* harmony import */ var _a__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./a */ 2); +/* harmony import */ var _a__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./a */ 4); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _a__WEBPACK_IMPORTED_MODULE_0__["a"]; }); -/* harmony import */ var _b__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./b */ 3); +/* harmony import */ var _b__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./b */ 5); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _b__WEBPACK_IMPORTED_MODULE_1__["b"]; }); -/* harmony import */ var _c__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./c */ 4); +/* harmony import */ var _c__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./c */ 6); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "c", function() { return _c__WEBPACK_IMPORTED_MODULE_2__["c"]; }); @@ -196,7 +199,7 @@ __webpack_require__.r(__webpack_exports__); /***/ }), -/* 2 */ +/* 4 */ /*!**************************************!*\ !*** ./node_modules/big-module/a.js ***! \**************************************/ @@ -210,7 +213,7 @@ const a = "a"; /***/ }), -/* 3 */ +/* 5 */ /*!**************************************!*\ !*** ./node_modules/big-module/b.js ***! \**************************************/ @@ -224,7 +227,7 @@ const b = "b"; /***/ }), -/* 4 */ +/* 6 */ /*!**************************************!*\ !*** ./node_modules/big-module/c.js ***! \**************************************/ @@ -238,31 +241,7 @@ const c = "c"; /***/ }), -/* 5 */ -/*!****************************************************!*\ - !*** ./node_modules/big-module-with-flag/index.js ***! - \****************************************************/ -/*! exports provided: a, b, c */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _a__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./a */ 6); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _a__WEBPACK_IMPORTED_MODULE_0__["a"]; }); - -/* harmony import */ var _b__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./b */ 7); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _b__WEBPACK_IMPORTED_MODULE_1__["b"]; }); - -/* harmony import */ var _c__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./c */ 8); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "c", function() { return _c__WEBPACK_IMPORTED_MODULE_2__["c"]; }); - - - - - - -/***/ }), -/* 6 */ +/* 7 */ /*!************************************************!*\ !*** ./node_modules/big-module-with-flag/a.js ***! \************************************************/ @@ -276,7 +255,7 @@ const a = "a"; /***/ }), -/* 7 */ +/* 8 */ /*!************************************************!*\ !*** ./node_modules/big-module-with-flag/b.js ***! \************************************************/ @@ -289,20 +268,6 @@ __webpack_require__.r(__webpack_exports__); const b = "b"; -/***/ }), -/* 8 */ -/*!************************************************!*\ - !*** ./node_modules/big-module-with-flag/c.js ***! - \************************************************/ -/*! exports provided: c */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return c; }); -const c = "c"; - - /***/ }) /******/ ]); ``` @@ -313,33 +278,33 @@ const c = "c"; ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.28.0 +Version: webpack 4.29.0 Asset Size Chunks Chunk Names -output.js 8.85 KiB 0 [emitted] main +output.js 7.51 KiB 0 [emitted] main Entrypoint main = output.js -chunk {0} output.js (main) 422 bytes [entry] [rendered] - > .\example.js main +chunk {0} output.js (main) 325 bytes [entry] [rendered] + > ./example.js main [0] ./example.js 140 bytes {0} [built] [no exports] - single entry .\example.js main - + 8 hidden modules + single entry ./example.js main + + 6 hidden modules ``` ## Production mode ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.28.0 +Version: webpack 4.29.0 Asset Size Chunks Chunk Names output.js 985 bytes 0 [emitted] main Entrypoint main = output.js chunk {0} output.js (main) 325 bytes [entry] [rendered] - > .\example.js main + > ./example.js main [0] ./example.js + 6 modules 325 bytes {0} [built] [no exports] - single entry .\example.js main + single entry ./example.js main | ./example.js 140 bytes [built] | [no exports] - | single entry .\example.js main + | single entry ./example.js main | + 6 hidden modules ``` diff --git a/examples/side-effects/webpack.config.js b/examples/side-effects/webpack.config.js new file mode 100644 index 00000000000..2bd35aa7c7e --- /dev/null +++ b/examples/side-effects/webpack.config.js @@ -0,0 +1,5 @@ +module.exports = { + optimization: { + sideEffects: true + } +};