developit / developit/microbundle
[Question] Sub-exports depending on main export bundle the entire main-export.
- 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ả
I have a project where I have a main-export and multiple other exports. The other exports are extensions that depend on the main-export, but I don't want them to be in the main-export to keep it as small as possible.
Users should be able to do:
```javascript
import {Thing} from 'package';
// optional addition
import {OtherThing} from 'package/a';
```
(or similarly using multiple script-tags with the umd-builds)
As for the source-files, it's roughly like this:
```typescript
// index.ts
export * from './main';
// main.ts
export class Thing {}
// a.ts
import {Thing} from './main';
export class OtherThing extends Thing {}
```
And the package.json contains these sub-exports:
```
"exports": {
".": {
"import": "./dist/index.modern.js",
"require": "./dist/index.js",
"umd": "./dist/index.umd.js",
"browser": "./dist/index.module.js"
},
"./a": {
"import": "./dist/a.modern.js",
"require": "./dist/a.js",
"umd": "./dist/a.umd.js",
"browser": "./dist/a.module.js"
},
}
```
With this, the output-files for '`./a`' (all formats) have the entire definition of '`./main.ts`' inlined.
So my question is, is there a way to configure microbundle to treat those other files as externals?
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 with the index.ts, main.ts, and a.ts examples and inspect how microbundle produces the dist/a.* outputs for each format. Check the package.json sub-export configuration and Rollup external handling first. Done means the ./a bundles avoid inlining main.ts while preserving the requested import and UMD usage.
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, typescript
- Lĩnh vực
- build-system, tooling
- Loại issue
- Tính năng
- Độ 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