'tsconfig.json path pattern
Is there any way to include files by path pattern? For example, I am currently doing this in my scripts:
import '../../../../myresource/src/shared/my-interface'
However, I would like to simply use this:
import '@myresource/shared/my-interface'
Notice that in the last example, specifying the 'src' folder has been skipped. Also, 'myresource' would be changed to match any folder at that path ('myresource', 'myresource1', 'myresource2', etc..), so I would like to know if there's any solution which would not require me to add each specific folder inside the 'paths' object of the tsconfig.json
Solution 1:[1]
You can do this in your tsconfig.json (example):
{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@*": ["*"]
}
}
}
You can also customize the paths for your needs.
{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@*": ["*", "dir1/*"]
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jazz |
