developit / developit/microbundle

Granular compress option

Đang mở
#1,031 3 bình luận 1 reaction 0 người được giao Xem trên GitHub
Feature Request
Ngôn ngữ chính
JavaScript
Star
8.1k
Fork
358
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I think it'd be great to be able to do this:

package.json
```json5
{
"name": "foo", // your package name
"type": "module",
"source": "src/foo.js", // your source code
"exports": {
"require": "./dist/foo.cjs", // used for require() in Node 12+
"default": "./dist/foo.modern.js" // where to generate the modern bundle (see below)
},
"main": "./dist/foo.cjs", // where to generate the CommonJS bundle
"module": "./dist/foo.module.min.js", // where to generate the ESM bundle
// note the 'min' here 👇👇👇
"unpkg": "./dist/foo.umd.min.js", // where to generate the UMD bundle (also aliased as "umd:main")
"scripts": {
"build": "microbundle", // compiles "source" to "main"/"module"/"unpkg"
"dev": "microbundle watch" // re-build when source files change
}
}
```

Then expand the `--compress` option to allow a regex. So, if you run `--compress min` it's saying "Compress the outputs that contain the string `min`". In the above case, it'd only minify the `module` and `unpkg` outputs.

This'd be useful to allow node users to use unminified code but browser users to use minified etc. It could be made to be non-breaking by making `--compress true` and `--compress false` special cases to enable/disable all.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.