developit / developit/microbundle

why esmodule set to false?

Open
#531 10 comments 1 reaction 0 assignees View on GitHub
discussion
Dominant language
JavaScript
Stars
8.1k
Forks
358
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.