When using this plugin we might end up with something like this:
Click
// 54:
// (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/*/ }),
// 92:
// (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/*/ }),
// 93:
// (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/*/ }),
// 94:
// (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/*/ }),
// 95:
// (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/*/ }),
// 96:
// (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/*/ }),
// 97:
// (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/*/ }),
// 98:
// (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/*/ }),
Seems like this could be optimized away - i know that probably minifier + gzip makes this kinda cheap, but parsing costs add up and it would be always good to strive for less code in such cases.
Please provide minimum reproducible test repo, it should be removed by webpack
I've somehow missed your reply. Gonna try to prepare slimmed down repro for this.
@evilebottnawi minimum reproducible test repo: https://github.com/irudoy/webpack-mceplugin-empty-repro
@evilebottnawi any thoughts?
@irudoy sorry, some busy, but you can send a PR with implementation this feature :+1:
@evilebottnawi I experimented a bit, but with no luck. Can you point out how to achieve this?
@irudoy we solved this problem for extract-text-webpack-plugin (https://github.com/webpack-contrib/extract-text-webpack-plugin/blob/webpack-1/index.js#L280), i think solution is same
Some results:
entry1: 269 empty modules
entry2: 186 empty modules
with empty modules:
entry1: 49.9 KiB / 14.3 KiB (gzip)
entry2: 15.8 KiB / 4.8 KiB (gzip)
without empty modules:
entry1: 40.4 KiB / 12.1 KiB (gzip)
entry2: 8.8 KiB / 3.3 KiB (gzip)
Great :+1:
Most helpful comment
@irudoy we solved this problem for extract-text-webpack-plugin (https://github.com/webpack-contrib/extract-text-webpack-plugin/blob/webpack-1/index.js#L280), i think solution is same