tree-shake改善のため barrel exports を廃止#17
Merged
Merged
Conversation
added 11 commits
January 8, 2026 19:52
Author
|
別途承認済みにつきセルフマージ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
変更概要
直近の変更で、 conditional exports に代表的なエントリーポイント(
index.js等による barrel exports)のみを定義し、個別モジュールの import を禁止する方向に統一した。しかし、これによってライブラリー利用側の tree-shake がしにくくなる問題があった。また、バンドルせずにNode.jsで実行するケースにおいても、モジュール解決のコストが上がることが予想される。
そのため、逆に従来の
index.js等を経由した re-exports の露出を廃止し、常に個別モジュールを明示指定して import するような利用方法に変更する。主な変更点
package.jsonのexportsフィールド等を更新dist/es/index.js等の露出を廃止する代わりに、ユーザーは任意のモジュールを明示指定して直接 import できるようにmain,module,typesフィールドは削除(近年の Node.js ではexportsフィールドのみで十分)dist/es/all.jsは残存しているが、これもexportsフィールドでは露出しない。all.jsはUMDのビルドに必要であり、そしてUMDは本プロジェクトのWeb環境でのテストに使われているため、すぐには完全削除できない状態src/**/index.jsを経由した import を避けて、個別モジュールを直接 import するようにts-patch等(後述)を使わなくてよくなるように、import パスを絶対パスsrc/...から相対パスに変更その他
dependenciesのnpm依存tslibを削除devDependenciesのnpm依存ts-patch,typescript-transform-pathsを削除1.17.1-mod.2026.4に更新