developit / developit/microbundle

why esmodule set to false?

Offen
#531 10 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
discussion
Vorherrschende Sprache
JavaScript
Sterne
8.1k
Forks
358
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

```
export const a = 10;
export const b = 10;
```
will generates following in microbundle, which missing `__esModule` flag
1.
```
// lib1.js
exports.a=10,exports.b=10;
//# sourceMappingURL=index.js.map
```
while using rollup generates the folloing code,which seems more accurate
2.
```
// lib2.js
'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const a = 10;
const b = 10;

exports.a = a;
exports.b = b;
```
which both works fine in the following
```
const { a,b } =require('lib')
console.log(a,b);
```
but behaves differently in the following code
```
import lib1 from "./lib1";
import lib2 from "./lib2";

console.log("lib1:", lib1); // lib1: { a:1,b:2}
console.log('lib2:',lib2); // lib2: undefiend
```
which lib2 seems more accurate

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.