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

Remove declaration dir warning when declarations are disabled #912

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andyrichardson
Copy link

About

Given the following tsconfig

{
  "compilerOptions": {
    "declaration": false
  }
}

The user will see this message whenever building

rpt2: options error TS5069: Option 'declarationDir' cannot be specified without specifying option 'declaration' or option 'composite'.

This PR introduces a check to only provide a declarationDir option to rollup if declarations aren't omitted.

Other stuff

This is just a proposal - the tsconfig.json would need to be properly interpreted in order to get the declaration value (e.g. to cover extends).

@changeset-bot
Copy link

changeset-bot bot commented Nov 25, 2021

⚠️ No Changeset found

Latest commit: 7f35910

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@rschristian
Copy link
Collaborator

rschristian commented Nov 30, 2021

I'm thinking we can just alter emitDeclaration to check for tsconfig.compilerOptions.declaration too (and accordingly change the condition for adding declarationDir to emitDeclaration)

Check options.generateTypes then tsconfig.compilerOptions.declaration and finally !!(pkg.types || pkg.typings). That should cover all the bases

Edit: The case of extends might be something that's acceptable to skip over for now. Mono-repo support (which is where I imagine the need for extending most often comes from) is already pretty limited by rpt2, making Microbundle not the best tool to use if that's the need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants