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

tsconfig exclude from an extends not working #663

Open
kylemh opened this issue Apr 5, 2020 · 2 comments
Open

tsconfig exclude from an extends not working #663

kylemh opened this issue Apr 5, 2020 · 2 comments
Labels
scope: upstream Issue in upstream dependency

Comments

@kylemh
Copy link
Contributor

kylemh commented Apr 5, 2020

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: #61

Your environment

Software Version(s)
TSDX latest
TypeScript latest
Browser Chrome latest
npm/Yarn yarn latest
Node node latest
Operating System MacOS latest
@kylemh kylemh changed the title tsconfig exlude not adhered too in subdirectories of a monorepo tsconfig exclude not adhered to in subdirectories of a monorepo Apr 5, 2020
@agilgur5
Copy link
Collaborator

agilgur5 commented Apr 6, 2020

This is a follow-up from #646 (comment)

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:

typescript({
typescript: ts,
cacheRoot: `./node_modules/.cache/tsdx/${opts.format}/`,
tsconfig: opts.tsconfig,
tsconfigDefaults: {
exclude: [
// all TS test files, regardless whether co-located or in test/ etc
'**/*.spec.ts',
'**/*.test.ts',
'**/*.spec.tsx',
'**/*.test.tsx',
// TS defaults below
'node_modules',
'bower_components',
'jspm_packages',
paths.appDist,
],
compilerOptions: {
sourceMap: true,
declaration: true,
jsx: 'react',
},
},
tsconfigOverride: {
compilerOptions: {
// TS -> esnext, then leave the rest to babel-preset-env
target: 'esnext',
},
},
check: !opts.transpileOnly,
useTsconfigDeclarationDir: Boolean(tsCompilerOptions?.declarationDir),
}),

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
Copy link
Contributor Author

kylemh commented Apr 7, 2020

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

@agilgur5 agilgur5 changed the title tsconfig exclude not adhered to in subdirectories of a monorepo tsconfig exclude from an extends not working Apr 8, 2020
@agilgur5 agilgur5 added the scope: upstream Issue in upstream dependency label Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: upstream Issue in upstream dependency
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants