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 目標,以及 package.json 中針對 node:fs 和 node:path 的瀏覽器對應來重現問題。將其行為與針對 fs 和 path 的對應進行比較;當帶有 node 前綴的內建模組在瀏覽器相容的建置中無需警告即可解析時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript, node.js
- 領域
- build-system
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100