Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Question] Sub-exports depending on main export bundle the entire main-export.

オープン
#1,027 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

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

調査の方向性

index.ts、main.ts、a.ts の例から始め、各フォーマットで microbundle が dist/a.* 出力をどのように生成するかを調べます。まず package.json のサブエクスポート設定と Rollup の external 処理を確認します。./a バンドルが main.ts をインライン化せず、要求された import と UMD の使用を維持できれば完了です。

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

説明

I have a project where I have a main-export and multiple other exports. The other exports are extensions that depend on the main-export, but I don't want them to be in the main-export to keep it as small as possible.

Users should be able to do:

import {Thing} from 'package';

// optional addition
import {OtherThing} from 'package/a';

(or similarly using multiple script-tags with the umd-builds)

As for the source-files, it's roughly like this:

// index.ts
export * from './main';

// main.ts
export class Thing {}

// a.ts
import {Thing} from './main';

export class OtherThing extends Thing {}

And the package.json contains these sub-exports:

"exports": {
    ".": {
      "import": "./dist/index.modern.js",
      "require": "./dist/index.js",
      "umd": "./dist/index.umd.js",
      "browser": "./dist/index.module.js"
    },
    "./a": {
      "import": "./dist/a.modern.js",
      "require": "./dist/a.js",
      "umd": "./dist/a.umd.js",
      "browser": "./dist/a.module.js"
    },
  }

With this, the output-files for './a' (all formats) have the entire definition of './main.ts' inlined.

So my question is, is there a way to configure microbundle to treat those other files as externals?

主要言語
JavaScript
スター
8.1k
フォーク
358
PR マージ指標
30日以内にマージされた PR はありません

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

developit/microbundle のほかの issue

developit/microbundle の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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