developit / developit/microbundle

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

Aperta
#782 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug :bug: help wanted :wave: upstream
Lingua principale
JavaScript
Stelle
8.1k
Fork
358
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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'`.

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.