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

VSCode resolution failing for "excluded" files #58

Closed
jplew opened this issue May 6, 2019 · 3 comments
Closed

VSCode resolution failing for "excluded" files #58

jplew opened this issue May 6, 2019 · 3 comments

Comments

@jplew
Copy link

jplew commented May 6, 2019

Hi:
VS Code path resolution and auto-completion work great with all my project files that have been explicitly "included", but fail for any files that have been excluded.

The relevant bits of my tsconfig.json:

{
  "compilerOptions": {
    "paths": {
      "~/*": ["./*"]
    }
  },
  "include": [
    "src/**/*"
  ],
  "exclude": [
    "src/__test__/**/*"
  ]
}

In my case, I want path aliasing functionality in my test files, but I don't want my tests transpiled and output to my outDir.

Is it possible to take advantage of module aliases in a file, while simultaneously excluding it from transpilation?

Screenshot for reference:

image

@Kehrlann
Copy link
Collaborator

Kehrlann commented May 6, 2019

Hi @jplew,

If I understand correctly, you're using only the typescript compiler for path aliasing as of today. So you are not using module-alias yet, correct ?
If I understand correctly so far: as your typescript config does not work with excluded file, you would like to use module-alias instead, to have path resolution working. That might not be the best thing, please check the discussion on #19

Let me know if it helps.

@jplew
Copy link
Author

jplew commented May 6, 2019

@Kehrlann thanks for the reply, and sorry if I was unclear. I already have module-alias installed and running in the above example.

The library works fine for all the files in my src directory, but VS Code fails to autocomplete or recognize the aliases in my src/__test__ directory.

I did read the thread you linked to. I'm not having the same problem as the OP, as VS Code plays nicely with module-alias, but only for the files specified in my include glob pattern.

Just wondering if it's possible for aliases to resolve in a file which is intentionally excluded from the compiler.

@Kehrlann
Copy link
Collaborator

I see you've found an answer in #19 👍 It's not something we plan to address anytime soon - I'll close this issue.

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

No branches or pull requests

2 participants