developit / developit/microbundle

why esmodule set to false?

Đang mở
#531 10 bình luận 1 reaction 0 người được giao Xem trên GitHub
discussion
Ngôn ngữ chính
JavaScript
Star
8.1k
Fork
358
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Start by reproducing the two generated CommonJS outputs from the export example and compare how their __esModule markers affect the shown default-import behavior. Read the microbundle and Rollup output configuration involved in CommonJS generation; done means determining whether the difference is intentional and documenting or correcting the behavior with a regression test.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, rollup
Lĩnh vực
build-system
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.