Skip to content
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

Inbuilt support for alternate minifiers #17398

Closed
burhanuday opened this issue Jun 18, 2023 · 8 comments
Closed

Inbuilt support for alternate minifiers #17398

burhanuday opened this issue Jun 18, 2023 · 8 comments

Comments

@burhanuday
Copy link
Member

Feature request

Have out of the box support for a faster minifier (possibly behind an experiment with the intention to make it default with webpack 6)

https://github.com/privatenumber/minification-benchmarks contains benchmark information for available minifiers. At this time, i dont have a strong preference towards an option

We have an open PR for a CSS minifier that we should consider under this issue as well #17309

What is the expected behavior?

Faster minification

What is motivation or use case for adding/changing the behavior?

To improve the build speed and DX, we should make it easy to switch to an alternate minifier

I am aware that another minifier can be passed explicitly but most devs dont know about this and face long build time issues. Minification is an area where we depend on an external tool that is not closely coupled to webpack

How should this be implemented in your opinion?

Let terser be the default choice for now. Have a flag experiment.<minifier-name> that when enabled, changes the JS (and possibly CSS) minifier

Are you willing to work on this yourself?
yes

@alexander-akait
Copy link
Member

alexander-akait commented Jun 18, 2023

We already support it - https://github.com/webpack-contrib/terser-webpack-plugin#swc, I don't think we need extra options, because it is just a couple of lines

@alexander-akait
Copy link
Member

Also we supported almost all minifiers - https://github.com/privatenumber/minification-benchmarks, excpet:

For last two we can add a support to https://github.com/webpack-contrib/terser-webpack-plugin#swc, feel free to send a PR

@burhanuday
Copy link
Member Author

I see, are we looking to change the default minifier to something faster with the next webpack version?

@alexander-akait
Copy link
Member

@burhanuday We haven't discussed this yet. I think will be great to align with rspack team here and maybe switch to swc, but before it we should check perf - not for minimizer, but for webpack - we have https://webpack.github.io/benchmark/, so lets add an extra scenario - production-build+swc-minimize - https://github.com/webpack/benchmark. Can you do it?

@burhanuday
Copy link
Member Author

@alexander-akait yes. will work on it.

@burhanuday
Copy link
Member Author

@alexander-akait opened a PR to the benchmark repo

@webpack-bot
Copy link
Contributor

This issue had no activity for at least three months.

It's subject to automatic issue closing if there is no activity in the next 15 days.

@webpack-bot
Copy link
Contributor

Issue was closed because of inactivity.

If you think this is still a valid issue, please file a new issue with additional information.

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

No branches or pull requests

3 participants