[Question] Sub-exports depending on main export bundle the entire main-export.
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, rollup, typescript
- Domain
- build-system, tooling
Research direction
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.
Written by the indexing model from the issue text.
Description
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:
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:
// 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?
- Dominant language
- JavaScript
- Stars
- 8.1k
- Forks
- 358
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from developit/microbundle
-
CSS
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
developit/microbundle#1002 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
developit/microbundle#789 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
developit/microbundle#1100 · 4 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
developit/microbundle#1094 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
developit/microbundle#1093 · 3 comments · 1 reaction ·
All issues in developit/microbundle
Similar issues
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
georgestephanis/p2026#40 ·
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Margaret-Petersen/food-delivery-app-clone-react-native#1981 ·