`module-sync` export points at `./src/index.js`, so `require('datastore-core')` (and 13 other packages) fails

オープン 初心者向け
#381 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
node.js, typescript
領域
release

調査の方向性

まずルートの "." エクスポートを packages/datastore-core/package.json から始めてください。ここで "module-sync" は ./src/index.js を指しています。これを packages/blockstore-core/package.json と比較してください。このファイルはすでに ./dist/src/index.js を使用しています。影響を受ける各 packages/*/package.json のルートエクスポートに同じ 1 行の変更を適用し、その後、ビルドと pack/install の後に require("datastore-core") と他の名前付きパッケージが読み込まれることを確認してください。完了とは、14 個のパッケージすべてが blockstore-core と一致し、MODULE_NOT_FOUND エラーがなくなっていることです。

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

説明

In 14 of the 15 packages in this repo, the root "." export added in #369 points "module-sync" at "./src/index.js" instead of "./dist/src/index.js", so require() fails with MODULE_NOT_FOUND because published tarballs only include .ts files under src/.

npm i [email protected] [email protected]
node -e 'require("datastore-core")'

Actual output (Node.js v26.13.0):

node:internal/modules/cjs/loader:772
      throw e;
      ^

Error: Cannot find module '.../node_modules/datastore-core/src/index.js'
    at createEsmNotFoundErr (node:internal/modules/cjs/loader:1650:15)
    at finalizeEsmResolution (node:internal/modules/cjs/loader:1639:9)
    at resolveExports (node:internal/modules/cjs/loader:765:14)
    at Module._findPath (node:internal/modules/cjs/loader:832:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1596:27)
    at wrapResolveFilename (node:internal/modules/cjs/loader:1145:27)
    at defaultResolveImplForCJSLoading (node:internal/modules/cjs/loader:1169:10)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1196:12)
    at Module._load (node:internal/modules/cjs/loader:1370:5)
    at wrapModuleLoad (node:internal/modules/cjs/loader:261:19) {
  code: 'MODULE_NOT_FOUND',
  path: '.../node_modules/datastore-core'
}

Expected output: the module loads without error, matching require("blockstore-core") (whose root "module-sync" is "./dist/src/index.js") and subpath exports like require("datastore-core/memory").

Affected packages and versions tested (also reproduced on main at 58d2e06): [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]. Changing "module-sync": "./src/index.js" to "./dist/src/index.js" in packages/*/package.json fixes require() across all of them.

Credit: https://ucsbplse.github.io/

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

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

ipfs/js-stores のほかの issue

ipfs/js-stores の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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