Skip to content

[Optimization request] Remove empty "modules" #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Andarist opened this issue Mar 4, 2019 · 10 comments · Fixed by #566
Closed

[Optimization request] Remove empty "modules" #357

Andarist opened this issue Mar 4, 2019 · 10 comments · Fixed by #566

Comments

@Andarist
Copy link

Andarist commented Mar 4, 2019

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.

@alexander-akait
Copy link
Member

Please provide minimum reproducible test repo, it should be removed by webpack

@Andarist
Copy link
Author

I've somehow missed your reply. Gonna try to prepare slimmed down repro for this.

@irudoy
Copy link
Contributor

irudoy commented Apr 4, 2019

@evilebottnawi minimum reproducible test repo: https://github.com/irudoy/webpack-mceplugin-empty-repro

@irudoy
Copy link
Contributor

irudoy commented Apr 8, 2019

@evilebottnawi any thoughts?

@alexander-akait
Copy link
Member

@irudoy sorry, some busy, but you can send a PR with implementation this feature 👍

@irudoy
Copy link
Contributor

irudoy commented Apr 8, 2019

@evilebottnawi I experimented a bit, but with no luck. Can you point out how to achieve this?

@alexander-akait
Copy link
Member

alexander-akait commented Apr 8, 2019

@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

@irudoy irudoy mentioned this issue Apr 18, 2019
6 tasks
@irudoy
Copy link
Contributor

irudoy commented Apr 18, 2019

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)

@alexander-akait
Copy link
Member

Great 👍

@aleen42
Copy link

aleen42 commented Apr 8, 2022

I found that the problem still exists when using [email protected] + [email protected].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants