language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

Support tsconfig option in svelte2tsx emitDts

Open quentinderoubaix opened this issue 1 year ago • 2 comments

Context

When working in a monorepository, it is possible to end up with the following structure:

  • package-a
    • tsconfig.json
  • package-b ➡️ depends on package-a
    • tsconfig.json ➡️ uses compiler path option to target the sources of package-a
    • tsconfig.build.json ➡️ no compiler path option

This allows a few things:

  • when checking any source file of package-b in your favorite IDE, navigating to a reference of package-a would open the source file, not the dist file
  • in the script commands of package-b, svelte-package and svelte-check can use tsconfig.build.json to make sure package-a is not re-transpiled

Issue

This is almost possible currently, as svelte-package supports a tsconfig option. However, the function emitDts from svelte2tsx does not support an input tsconfig path, so this results in unexpected behavior.

A reproduction repo to see the issue in action: https://github.com/quentinderoubaix/showcase-tsconfig/tree/main

Proposed solution

Allow an extra option tsconfig in emitDts of package svelte2tsx + update svelte-package in svelte-kit to use it.

Alternatives

No response

Additional Information, eg. Screenshots

If this issue is deemed valid, I would be down to contribute in both this repo and kit to handle it.

quentinderoubaix avatar Apr 29 '24 14:04 quentinderoubaix

Sorry for the late reply - this makes total sense, contributions welcome!

dummdidumm avatar Jul 31 '24 12:07 dummdidumm

Tracking stuff to do:

  • [x] add tsconfig option in emitDts
  • [ ] pass through the tsconfig option in svelte-package

quentinderoubaix avatar Aug 01 '24 08:08 quentinderoubaix

Closing since both tasks are done - thanks again!

dummdidumm avatar Sep 06 '24 12:09 dummdidumm