patternfly / patternfly/patternfly-react

Bug - Package Publishing - Published Libraries should follow NPM dual module package standards

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

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

Breaking change :boom: Stale
主要言語
TypeScript
スター
862
フォーク
392
平均マージ
4日 8時間
マージ済み PR(30日)
9

説明

PatternFly libraries should follow NPM standards for publishing dual module (CommonJS/ESModule) packages.

PatternFly packages have

  "main": "dist/js/index.js",
  "module": "dist/esm/index.js",
  "types": "dist/esm/index.d.ts",

This is a really early format when es modules were being initially developed and not supported by modern tooling.

NPM documentation links to this as the right way to handle dual module packages.

{
  "type": "module",
  "exports": {
    "import": "./index.mjs",
    "require": "./index.cjs"
  }
}

Modern tooling like vite builds libraries with a combination of both for compatibility.

{
  "name": "my-lib",
  "type": "module",
  "main": "./dist/my-lib.umd.cjs",
  "types": "./dist/my-lib.d.ts",
  "module": "./dist/my-lib.js",
  "exports": {
    ".": {
      "import": "./dist/my-lib.js",
      "require": "./dist/my-lib.umd.cjs"
    }
  }
}

This is currently blocking us from using vitest to test because it gets really confused. It tries to import the code as ESM but then is unhappy that the package is not marked as type "module". If we manually add type 'module', it then runs into some code that uses a 'require', which is not valid in the scope of a module.

PatternFly packages should support both ESM and CommonJS using NPM standards for better compatibility.

This affects all PF packages not just react-core.

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

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

はじめの一歩

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

調査の方向性

すべてのPatternFlyパッケージについて、issueに示されているパッケージメタデータのフィールドを確認し、その後、vitestで現在のモジュール解決の問題を再現します。まずNPM package-examplesとVite library-modeのリファレンスを確認してください。影響を受けるすべてのパッケージが標準のパッケージメタデータを通じてESMとCommonJSの両方をサポートすれば完了です。

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

評価

技術スタック
nodejs, typescript
領域
build-system, developer-experience, release
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

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

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