-
Notifications
You must be signed in to change notification settings - Fork 179
How to exclude certain paths from awesome-typescript-loader only? #359
Comments
Perhaps a better question would be why are files under the "tests" folder being loaded at all? I mean, in my webpack configuration I have a single entry point file for my app. From this file, the imports will include all other required modules to make my app work. No file inside the "app" folder is importing a module in the "tests" folder. So, why are the files under "tests" being loaded!? |
@rfgamaral I believe that the reason that your tests folder is being loaded is because the source of the files that are being processed is not coming from webpack it is coming from TypeScript via your tsconfig.json file. To exclude your tests directory what you can do is add an exclude section to your tsconfig.json file. It would look something like this:
|
@kgs916 But should they? I really thought that the files loaded by Webpack were only the ones referenced as an entry point (and the ones referenced by those). I guess I was wrong. I tried that Am I doing something wrong here or I'm the only one trying to exclude test files in Thanks for your response :) |
@rfgamaral I agree, makes more sense for the files affected to only include the ones being handled by webpack. Sounds like a good candidate for a PR. In the mean time, you could have a separate tsconfig file that is only by this loader. So, the editors would continue using |
Closed in favour of #364 |
Thank you for taking the time dealing with this issue and the suggestion :) |
I was looking at this issue because we have a build that uses ts-loader, I thought I'd try out atl but it was picking up our /src/custom-type-definitions folder even though it's excluded in tsconfig.json and it isn't used by any code (we npm include them into node_modules/@types/ and use them from there. So atl is picking up definitions from all over the codebase, regardless of location or exclusion. Is that expected behaviour? Does ATL just scan the entire rootDir for *.d.ts? |
@damonsmith no, ATL just uses internal TypeScript machinery to resolve files. Please make sure that your have correct |
This may be useful for some: how to make ATL check only those files that are referenced: TL;DR: set |
@winston01, this approach doesn't work with webpack 3.10.0 and awesome-typescript-loader 3.4.1. |
I have an "app" and "tests" folders on the root of my project and I need to exclude the "tests" folder from
awesome-typescript-loader
. There doesn't seem to be an option for that on the loader...This is my current
tsconfig.json
file that is currently used byawesome-typescript-loader
by default:One way to achieve what I want is to add an
exclude
array to thetsconfig.json
above but that's not good because then Sublime Text (and I've also tried with Visual Studio Code) will not recognize anything when I open one of my.ts
files inside the "tests" folder.In other words, I need to exclude the "tests" folder only from
awesome-typescript-loader
, not globally. AFAIK,awesome-typescript-loader
only allows one to override thecompilerOptions
section of thetsconfig.json
file, not the other root properties likefiles
,include
orexclude
.What can I do to achieve this?
The text was updated successfully, but these errors were encountered: