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

bug: tsconfig include array triggers warning when path has leading ./ #4667

Closed
3 tasks done
cam-narzt opened this issue Aug 9, 2023 · 6 comments
Closed
3 tasks done
Assignees
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil

Comments

@cam-narzt
Copy link
Contributor

Prerequisites

Stencil Version

4.0.4

Current Behavior

if your tsconfig looks like this:

"include": [
        "./app/javascript"
    ],

you will get the very confusing warning:

[ WARN  ]  tsconfig.json "include" required
           In order for TypeScript to improve watch performance, it's recommended the "tsconfig.json" file should have
           the "include" property, with at least the app's "app/javascript" directory listed. For example: "include":
           ["app/javascript"]

Expected Behavior

paths that are equivalent shouldn't raise this warning

System Info

npx stencil info doesn't work on my system and isn't relevant in this case.

Steps to Reproduce

clone linked repo
checkout tsconfig_bug branch
run npm i
run npm run build

Code Reproduction URL

https://github.com/cam-narzt/stencilbug/tree/tsconfig_bug

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Aug 9, 2023
@rwaskiewicz rwaskiewicz self-assigned this Aug 10, 2023
@rwaskiewicz
Copy link
Member

Hey @cam-narzt 👋

Thanks for bug report + reproduction case! I took a look at it this morning, and wasn't able to reproduce the error exactly on my end. Following the steps to repro, I:

  • Cloned the repo
  • Checked out tsconfig_bug (where the HEAD is c417fd76254031f390d0b564c18af36d1dce350e)
  • Ran npm ci to get the same dependencies
  • Ran npm run build

I do get an error message, but it looks like it's properly listing the 'src' directory in the error message instead of 'app/javascript':

➜  stencilbug git:(tsconfig_bug) npm run build

> demo-error@0.0.1 build
> stencil build --docs

[56:01.5]  @stencil/core
[56:01.7]  v4.0.4 🍧

[ WARN  ]  tsconfig.json "include" required
           In order for TypeScript to improve watch performance, it's recommended the "tsconfig.json" file should have
           the "include" property, with at least the app's "src" directory listed. For example: "include": ["src"]

Does it look like I'm missing anything here?

@rwaskiewicz rwaskiewicz added the Awaiting Reply This PR or Issue needs a reply from the original reporter. label Aug 10, 2023
@ionitron-bot ionitron-bot bot removed the triage label Aug 10, 2023
@cam-narzt
Copy link
Contributor Author

Ah I forgot to commit one file while I was making the reproduction repo, the head is 72c19dcc now.

the stencil config srcDir and tsconfig include must match exactly, being equivalent isn't enough, which is what makes the error confusing.

@ionitron-bot ionitron-bot bot removed the Awaiting Reply This PR or Issue needs a reply from the original reporter. label Aug 10, 2023
@rwaskiewicz
Copy link
Member

Ah, gotcha! Makes sense - I can reproduce this now. Thanks!

@rwaskiewicz rwaskiewicz added the Bug: Validated This PR or Issue is verified to be a bug within Stencil label Aug 10, 2023
rwaskiewicz added a commit that referenced this issue Aug 10, 2023
this commit fixes a bug where a user was unable to use relative paths in
the `include` property of their `tsconfig.json` file if `srcDir` was
also specified.

previously, when `tsconfig.json#include` contained a relative path:
```
"include": [
  "./app/javascript"
],
```
and `tsconfig.json#srcDir` included the non-relative version of that path:
```
srcDir: 'app/javascript',
```

then you would receive a very confusing error:
```
[ WARN  ]  tsconfig.json "include" required
           In order for TypeScript to improve watch performance, it's recommended the "tsconfig.json" file should have
           the "include" property, with at least the app's "app/javascript" directory listed. For example: "include":
           ["app/javascript"]
```

closes #4667
@rwaskiewicz
Copy link
Member

@cam-narzt I've created #4676 to fix this - I've created a dev build of Stencil that includes the fix atop of v4.0.4. If you get a moment, can you try installing it and let me know how it goes?

npm i @stencil/core@v4.0.4-dev.1691704809.9fb61d7

@cam-narzt
Copy link
Contributor Author

That fixed the issue on my end, lgtm.

github-merge-queue bot pushed a commit that referenced this issue Aug 14, 2023
this commit fixes a bug where a user was unable to use relative paths in
the `include` property of their `tsconfig.json` file if `srcDir` was
also specified.

previously, when `tsconfig.json#include` contained a relative path:
```
"include": [
  "./app/javascript"
],
```
and `tsconfig.json#srcDir` included the non-relative version of that path:
```
srcDir: 'app/javascript',
```

then you would receive a very confusing error:
```
[ WARN  ]  tsconfig.json "include" required
           In order for TypeScript to improve watch performance, it's recommended the "tsconfig.json" file should have
           the "include" property, with at least the app's "app/javascript" directory listed. For example: "include":
           ["app/javascript"]
```

closes #4667
@rwaskiewicz
Copy link
Member

The fix for this issue went out with today's v4.0.5 release. As such, I'm going to close it out. Should it appear again, please feel free to open a new issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil
Projects
None yet
Development

No branches or pull requests

2 participants