Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
feat: add --pkg-main option #658
Conversation
|
Nice - @wardpeet and I were looking at breaking those functions out anyway, and I like the way you've done it here! |
|
Stellar work, as usual. |
| const { pkg } = options; | ||
| const pkgMain = options['pkg-main']; | ||
|
|
||
| if (!pkgMain) { |
developit
Jun 12, 2020
Owner
I wonder if we could even apply this same logic if the value provided for the --output argument has a file extension. Like microbundle -f umd -o bundle.js would see .js and know to use that name as-is.
katywings
Jun 12, 2020
Author
Collaborator
I think this would open to questions:
- Such a new logic could be a "breaking" change because there might be people already using -o with ".js" and expecting it to add the format suffix. If a breaking change would mean that this has to wait for 1.0 I personally would prefer to split this idea into another issue
😇 - If we implement this logic, it should only ever apply if the format option is set with a single value
marvinhagemeister
Jun 13, 2020
Collaborator
Agree with @katywings here. I'm worried that us making too many assumptions will lead to unexpected results for the user. In either case this would be a breaking change.
5378311
to
859fdba
|
Awesome, thank you so much for the PR |
The goal of this feature is to add a solution for microbundle, to manually disable the package.json / format suffix automations analog to https://twitter.com/Katy_Wings/status/1271189844077748224
The new option
--pkg-mainby default is true - basically notifying the consumer that main entries in package.json will be considered. The consumer can supply--pkg-main falseto disable the microbundle package.json "sideffects".This PR also includes a little refactor of the "main" generation - most of it is the same as before but just moved into separate functions.