developit / developit/microbundle
Failed to resolve the module node:* when target ≠ "node"
- 主要言語
- JavaScript
- スター
- 8.1k
- フォーク
- 358
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Similar to https://github.com/developit/microbundle/issues/989, but now occurring only when Microbundle's target is not Node.js. I'm compiling a library that runs in both Node.js and a browser, and the library contains dynamic imports for node built-ins like 'fs', executed only in Node.js.
When importing `fs` I can add the following to my `package.json` and everything works fine:
```
"browser": {
"fs": false,
"path": false
},
```
However, using `node:fs`, the same thing does not work, and warnings appear with:
```
"browser": {
"node:fs": false,
"node:path": false
},
```
```
Failed to resolve the module node:fs
```
Microbundle v0.15.1, Node.js v18.12.1.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
まず、Microbundle v0.15.1、Node ではないターゲット、および node:fs と node:path に対する package.json のブラウザマッピングを使って問題を再現します。fs と path のマッピングの場合の動作と比較します。ブラウザ互換ビルドで node プレフィックス付きの組み込みモジュールが警告なしに解決されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- build-system
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100