developit / developit/microbundle

Granular compress option

オープン
#1,031 コメント 3 件 リアクション 1 件 担当者 0 名 GitHub で見る
Feature Request
主要言語
JavaScript
スター
8.1k
フォーク
358
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start by locating the `--compress` option and the code that maps package.json outputs such as `main`, `module`, and `unpkg` to generated bundles. Check how the current true/false compression behavior is handled, then verify that a regex-like value such as `min` only compresses matching output paths while the existing boolean cases still work.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
build-system
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。