developit / developit/microbundle

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

Aperta
#1,036 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
8.1k
Fork
358
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.