add image-compression#71
Conversation
1585b05 to
31fd8de
Compare
| // ... | ||
| ``` | ||
|
|
||
| - imageCompression |
There was a problem hiding this comment.
感觉跟上边的命名风格保持一致的话应该是 compressImage?
| const compressionIfNecessary = rule => { | ||
| const loaders = rule.use | ||
| const firstLoaderName = loaders[0].__loaderName__ | ||
| if (firstLoaderName !== 'file-loader' || !utils.isImage(rule.test)) { |
There was a problem hiding this comment.
判断是不是 image 的话,是不是用 add-transform 那的 extension 更准确一点?而且下边我看会去改 loaders,要不干脆把这事儿挪到 add-transform 里做(那边判断下 env 跟 optimization)?
虽然这样 add-transform 里边逻辑会趋于越来越多,不过我们可以回头再去想怎么拆那边,比如按 extension 拆开逻辑组织
There was a problem hiding this comment.
这个和 extract-style 是统一类型的啊,我和那个保持统一了
There was a problem hiding this comment.
这个是建立在现在的 test 全是通过 makeExtensionPattern 创建的,我能想到的情况是,比如我们 transform 填后缀名那边支持 * 了,然后估计就会对应创建一个类似 .*$ 的 test,那它也就被识别成 image 了。。
我觉得主要点在于,这个 test 是只考虑到给 webpack 用的,不会预期我们自己会去依据它的值做一些判断逻辑;这也是 extract-style 那边会特地通过一个 __loaderName__ 来获取可靠的 loader 名的原因;所以这边如果像现在这样组织的话,那也把 extension 信息通过某个我们自己的字段给出来,会更可靠一点。
There was a problem hiding this comment.
在 rule 里新加一个 extension 字段?
There was a problem hiding this comment.
那个 issuer 字段是 webpack 本身就有的么
6f1229e to
bf6a697
Compare
81efd88 to
2cfe002
Compare
2cfe002 to
d7025dd
Compare
|
go |
fix https://github.com/Front-End-Engineering-Cloud/builder/issues