Officially support more elaborate externals
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript, rollup
- 領域
- build-system, cli
調査の方向性
まず src/index.js#L387-L388 の external と exclude の処理を確認し、その後、issue で提案されている --external と --external-glob のコマンドライン動作を確認します。選択した設定セマンティクスが実装およびドキュメント化され、依存関係と標準外の import がどのように扱われるかも含まれていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
This is a feature request/Proposal
As a user of microbundle I want ways to configure which imports are to be considered external.
In order to reduce my bundle size and also to work with non-standard imports (images, fonts, ...) that are not supported by microbundle.
Status Quo
- As described in https://github.com/developit/microbundle/issues/283#issuecomment-523879163, there is a (I guess unoffical) way to use regex in the
--excludeflag, which can be used to have rollup treat specific import statements as external. - Presence of the
--excludeflag triggers if pkg.dependencies are treated as external or not (see index.js#L387) I find that quite confusing and the behaviour is not documented.
Problem
Given I want to use --external .*/assets/.* to work with non-standard imports
And I also want all my dependencies to be excluded
Then I need to add all dependencies to --external causing code duplication and manual overhead.
Proposal
In order to fix the problem and reduce confusion I propose to have it work like this:
$ microbundle
Exclude dependencies, peerDependencies
$ microbundle --external .*/assets/.*
Exclude dependencies, peerDependencies and .*/assets/.*
And explicitly support regular expressions or globs under --external
$ microbundle --external .*/assets/.*,angular --include-dependencies
Exclude peerDependencies and .*/assets/.*
All normal dependencies ecxept angular are included in the bundle
Non-breaking alternative
I realize that the above proposal is really tied to my personal usecase of (miss-?)using --external for non-standard imports.
It would also introduce a potential pretty impactful breaking change (since users of microbundle might ship bundles that lack bundled dependencies).
Alternatively the current behaviour could stay as is, using regex in --external will be considered hacky. And we introduce a new, documented way to exclude assets:
$ microbundle --external-glob **/*.(jpg|png)
Exclude dependencies, peerDependencies and all imports matching **/*.(jpg|png)
$ microbundle --external angular --external-glob **/*.(jpg|png)
Exclude peerDependencies, angular, and all imports matching **/*.(jpg|png)
Let me know what you think about this. I would be really happy to implement the changes and provide a PR.
- 主要言語
- JavaScript
- スター
- 8.1k
- フォーク
- 358
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
developit/microbundle のほかの issue
-
CSS
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
developit/microbundle#1002 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
developit/microbundle#789 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
developit/microbundle#1100 · コメント 4 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
developit/microbundle#1094 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
developit/microbundle#1093 · コメント 3 件 · リアクション 1 件 ·
developit/microbundle の issue をすべて見る
似ている issue
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
georgestephanis/p2026#40 ·
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Margaret-Petersen/food-delivery-app-clone-react-native#1981 ·