Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add --pkg-main option #658

Merged
merged 3 commits into from Jun 14, 2020

Conversation

@katywings
Copy link
Collaborator

@katywings katywings commented Jun 12, 2020

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-main by default is true - basically notifying the consumer that main entries in package.json will be considered. The consumer can supply --pkg-main false to 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.

@developit
Copy link
Owner

@developit developit commented Jun 12, 2020

Nice - @wardpeet and I were looking at breaking those functions out anyway, and I like the way you've done it here!

Copy link
Owner

@developit developit left a comment

Stellar work, as usual.

README.md Outdated Show resolved Hide resolved
const { pkg } = options;
const pkgMain = options['pkg-main'];

if (!pkgMain) {

This comment has been minimized.

@developit

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.

This comment has been minimized.

@katywings

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

This comment has been minimized.

@marvinhagemeister

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.

@katywings katywings force-pushed the lufrai:feature-no-format-suffix branch from 5378311 to 859fdba Jun 12, 2020
Copy link
Collaborator

@marvinhagemeister marvinhagemeister left a comment

Awesome, thank you so much for the PR 🙌

@marvinhagemeister marvinhagemeister merged commit f4ab33d into developit:master Jun 14, 2020
2 checks passed
2 checks passed
build (12.x)
Details
build (13.x)
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.