developit / developit/microbundle

Why re-export overriding does not work if I use microbundle ?

Abierto
#782 3 comentarios 0 reacciones 0 asignados Ver en GitHub
bug :bug: help wanted :wave: upstream
Lenguaje dominante
JavaScript
Estrellas
8.1k
Forks
358
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Hi guys,

I have run into some really weird situation here. Here is some [demo code](https://github.com/qjnz/re-export-override-demo) here, which does not use `microbundle` in that project.

What I am trying to do is like the following:
```js
import { theFunction } from './myOverrides'

export * from 'some-library'
export { theFunction } // theFunction here should override the theFunction from the `some-library`
```

However, from the emitted umd.js or common.js file that I got from `microbundle`, the `theFunction` does not get override since I can see that the legacy javascript code I got from the output is doing something like below

```js
Object.keys(r).forEach(function (e) {
'default' !== e &&
Object.defineProperty(exports, e, {
enumerable: !0,
get: function () {
return r[e]
},
})
}),
```

which the latter export `export { theFunction }` does not override it.

My question is that if somehow the `microbundle` does some magic here about `export * from 'some-library'`.

Guía de contribución

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

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.