developit / developit/microbundle

Failed to resolve the module node:* when target ≠ "node"

Đang mở
#1,036 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
8.1k
Fork
358
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.