I have several files that I want to compile with a script. These files rely on a compilation option pathsto solve their modules. Since I want to specifically target these files, I must provide them tsc(since I do not want to create a separate tsconfig.jsonone that is designed for these files for this task)
I considered the option of passing a parameter --pathto tsc, but this is not allowed ( error TS6064: Option 'paths' can only be specified in 'tsconfig.json' file.)
Is it possible in some way to compile only those files .tsusing the parameter paths?
Update (22-06-17)
As requested, some specific examples:
The relevant settings in the file are tsconfig.jsonas follows:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"Components/*": [
"./src/Components/*"
]
}
}
}
therefore, the relevant part is setting up paths where you can create shortcuts for importing files from a specific directory. so you can import a file of type import {header} from 'Components/header.ts'insteadimport {header} from '../../Components/header.ts'
But I need to compile specific files from the command line. But if I try:
tsc --project tsconfig.json entryFile.ts
he will give me an error:
error TS5042: Option 'project' cannot be mixed with source files on a command line.
and if I try to provide a parameter pathsfor cli, I get the following error:
error TS6064: Option 'paths' can only be specified in 'tsconfig.json' file.
source
share