developit / developit/microbundle

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

Offen
#782 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug :bug: help wanted :wave: upstream
Vorherrschende Sprache
JavaScript
Sterne
8.1k
Forks
358
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.