webpack-contrib / file-loader

File Loader
MIT License
1.86k stars 257 forks source link

RFC: uglify option #380

Closed ghost closed 4 years ago

ghost commented 4 years ago

Feature Proposal

How about add uglify option? Now interpolateName provides hash function. But we can use just 'A' or '~' and get lighter bundle file. If webpack team has a will on this, I wanna apply this module: https://github.com/TroyTae/uglify-set

Summary specification

name: uglify type: Boolean default: false

alexander-akait commented 4 years ago

Please open an issue here https://github.com/webpack/loader-utils, we should solve it for interpolateName, not for loader

ghost commented 4 years ago

@evilebottnawi I think we need to do this work in loader. Because we have to use different uglify method according to target. For example, file name can use number at first word, but css class name cannot use like that.

alexander-akait commented 4 years ago

@TroyTae No, it should be in interpolateName, you will can use [ugly-name].[ext] placeholder for this case

ghost commented 4 years ago

@evilebottnawi Ok then I'll make a issue in loader-util. Maybe we need to split value of option. Boolean -> String('filename' | 'css' | '~~~')