jaredpalmer / tsdx

Zero-config CLI for TypeScript package development
https://tsdx.io
MIT License
11.26k stars 508 forks source link

tsconfig `exclude` from an `extends` not working #663

Open kylemh opened 4 years ago

kylemh commented 4 years ago

Current Behavior

When using a monorepo, I'd like to minify the amount tsconfig I am defining per package. To that end, the value of the exclude property at the root config is being ignored when building TSDX packages in their own subdirectories.

You can test for yourself thru this example project by doing:

yarn install
yarn workspace @innocuous/components add @innocuous/hooks
yarn workspace @innocuous/hooks run build
yarn workspace @innocuous/components run build

and noticing that storybook files are compiled, despite being ignored from the root config extended by the package's config.

It seems like running tsc with my tsconfigs works as expected, but the build step continues to compile things I am excluding.

Expected behavior

In the example repo, stories are not compiled.

Suggested solution(s)

Unsure... I'd love to resolve this myself. @agilgur5 has DMs disabled on Twitter, but I was curious if anybody would be down to pair for a short chat about how files/folders are chosen for the build step in tsdx.

Additional context

Similar issue resolved: https://github.com/jaredpalmer/tsdx/issues/61

Your environment

Software Version(s)
TSDX latest
TypeScript latest
Browser Chrome latest
npm/Yarn yarn latest
Node node latest
Operating System MacOS latest
agilgur5 commented 4 years ago

This is a follow-up from https://github.com/jaredpalmer/tsdx/pull/646#issuecomment-609078762

how files/folders are chosen for the build step in tsdx.

There's nothing special, the source code just adds some defaults and passes to rpts2: https://github.com/jaredpalmer/tsdx/blob/f58de19871a03c15a84bb0da1ba97b374e846c2a/src/createRollupConfig.ts#L146-L177

I'd need to check your repo and see how tsc was working, but if this is really a bug, it'd be upstream in rpts2 since TSDX doesn't do anything fancy. Afaik in the rpts2 source code (I've contributed a small bit to fix issues here), it doesn't do much with include / exclude either and passes that to the TS API. Which is why I'm surprised if it doesn't handle exactly like tsc

kylemh commented 4 years ago

Yeah. I was surprised as well. Sure enough running TSC won’t compile storybook files, but TSDX build will.