developit / developit/microbundle

Mixed default and named exports changes default export

Đang mở
#712 16 bình luận 7 reaction 0 người được giao Xem trên GitHub
enhancement :rocket: known issue
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ả

Hey everyone! I am having the following issue, if I export like this:

```javascript
import GoogleMap from './google_map';

export default GoogleMap;
```

It will build:
```javascript
module.exports = GoogleMap;
```

However, when including named exports:
```javascript
import GoogleMap from './google_map';

export { namedExport1, namedExport2 } from './named_exports;

export default GoogleMap;
```

it changes to:

```javascript
exports.namedExport1 = namedExport1;
exports.namedExport2 = namedExport2;
...
exports.default = GoogleMap;
```

Which results in the following error:

**Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.**

I am pretty sure you will ask why we do need default exports, in my case I've a library that is used by a lot of people, I switched to microbundle a bit ago and realized later on this was buggy and it won't work with SSR unless we do `module.exports`, thing is even if I want to change the way we import / export to work with microbundle, I need to provide backwards compatibility or something...

I think this might be related to #264 and #306 but I am not completely sure if that's the case.

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

Đánh giá

Issue này chưa được đánh giá.

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.