developit / developit/microbundle

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

Abierto
#1,036 2 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
8.1k
Forks
358
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start by reproducing the issue with Microbundle v0.15.1, a non-Node target, and the package.json browser mappings for node:fs and node:path. Compare the behavior with the mappings for fs and path; done means node-prefixed built-ins resolve without warnings for browser-compatible builds.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript, node.js
Área
build-system
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.