Fix ESM exports
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 30/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- node.js, typescript
調査の方向性
まず、issue で挙げられている package metadata と ESM の例を確認します。これには rc-field-form/es/utils/validateUtil.js、rc-dialog/es/Dialog/Content/Panel.d.ts、rc-picker/es/interface.d.ts が含まれます。示されている NodeNext tsconfig の下で、rc-* packages が lib と es のツリーをどのように公開しているかを確認します。react-component modules 全体の ESM imports と type imports が、記載されている TypeScript、runtime、または esbuild のエラーなしに解決されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
There are many errors to fix in all react-component modules for them to work well when imported from an ESM module.
Importing things from "rc-???" & types from "rc-???/es/..." from an ESM module with recommended (less fault-tolerant / strictest) TS config should not raise any error.
My tsconfig.json contains:
{
"compilerOptions": {
"moduleResolution": "NodeNext",
"module": "NodeNext",
"skipLibCheck": false,
"skipDefaultLibCheck": false,
"allowImportingTsExtensions": false,
"allowSyntheticDefaultImports": false,
"strict": true,
"verbatimModuleSyntax": true,
"isolatedModules": true
},
}
Origin of errors:
- ESM files in
"rc-???/es/..."must have.d.mtsor.mjsextension, or apackage.jsoncontaining{"type":"module"}must be added to the folder - in
"rc-???/es/..."do not import any file from CJS exports of a module, there should not have anyimport ... from 'rc-???/lib/...';=> import will fail if (and it would be a good thing) imported module restricts its/lib/path to only CJS requires (exportsfield inpackage.json) - in
"rc-???/es/..."any relative import (specifier or expression) in a.d.tsor.jsshould point to a file (not a directory) and have a file extension => TS error since modules are resolved asany - there should be no comment between
/*#__PURE__*/comment and the function call, cfrc-field-form/es/utils/validateUtil.js=> esbuild error during build - modules with no default export (such as
react) should not be imported usingimport Module from 'module'but instead withimport * as Module from 'module', cfrc-dialog/es/Dialog/Content/Panel.d.tsorrc-picker/es/interface.d.ts=> TS error withallowSyntheticDefaultImportsdisabled and runtime error without a bundler that fakes a default import - TS looks for types through the
mainfield ofpackage.json, even when module is imported from an ESM, sopackage.jsonshould be patched with:
- "main": "./lib/index",
- "module": "./es/index",
+ "exports": {
+ ".": {
+ "types": {
+ "import": "./es/index.d.ts",
+ "default": "./lib/index.d.ts"
+ },
+ "import": "./es/index.js",
+ "default": "./lib/index.js"
+ },
+ "./es/*": {
+ "types": {
+ "import": "./es/*"
+ },
+ "import": "./es/*"
+ },
+ "./lib/*": {
+ "types": {
+ "require": "./lib/*"
+ },
+ "require": "./lib/*"
+ }
+ },
Interesting reading:
- 主要言語
- TypeScript
- スター
- 670
- フォーク
- 205
- 平均マージ
- 14日 12時間
- マージ済み PR(30日)
- 3
環境構築
このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
react-component/util のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
react-component/util#816 ·
-
injectCSS method not attaching csp nonce passed to it. it is used in antd components internallyオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
react-component/util#671 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
react-component/util#738 · コメント 1 件 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
react-component/util#710 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
react-component/util#647 · コメント 5 件 ·
react-component/util の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
melgarafael/DeskcommCRM#1812 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
prisma/prisma-cli#309 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
gregwebs/pi-quota-dispatcher#26 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
openwatersio/slackwater.xyz#124 ·
メンテナーはふだん 1 日以内に返信
-
agent-reported area/browser area/docs documentation good first issue hacktoberfest help wanted P2
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 2 日以内に返信