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: auto config preset #30

Merged
merged 9 commits into from
Dec 10, 2021
Merged

feat: auto config preset #30

merged 9 commits into from
Dec 10, 2021

Conversation

danielroe
Copy link
Member

This PR adds support for magic inferring of build configuration from package.json, if it isn't specified in build.config.

For example:

{
  "exports": "./dist/index.mjs",
  "types": "dist/index.d.ts",
  "bin": {
    "unbuild": "./dist/cli.mjs"
  }
}

Assuming we have the appropriate source files, unbuild will infer that we should generate types, that we don't need to emit CJS outputs, and that there are two entries: src/index and src/cli. We also support generating mkdist-powered directory outputs from export subpath patterns.

It was inspired by siroc's implementation but there are some important differences. Notably we can't define on a per-entrypoint whether or not to emit declaration file or CJS, so if any one output requires .cjs or .d.ts then it will switch on the flag for the entire build.

TODO:

resolves #3

@danielroe danielroe added the enhancement New feature or request label Dec 9, 2021
@danielroe danielroe requested a review from pi0 December 9, 2021 11:21
@danielroe danielroe self-assigned this Dec 9, 2021
@pi0 pi0 changed the title feat: magic build config inference feat: auto config preset Dec 10, 2021
@pi0 pi0 merged commit fe1ac94 into main Dec 10, 2021
@pi0 pi0 deleted the feat/magic-entry-inference branch December 10, 2021 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

infer entries if build.entries not defined
2 participants