mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore(core): monorepo, esm targeting, improved management (#8707)
This commit is contained in:
25
packages/webpack/utils/tsconfig-utils.ts
Normal file
25
packages/webpack/utils/tsconfig-utils.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import * as ts from 'typescript';
|
||||
|
||||
export function getCompilerOptionsFromTSConfig(tsConfigPath: string): ts.CompilerOptions {
|
||||
const parseConfigFileHost: ts.ParseConfigFileHost = {
|
||||
getCurrentDirectory: ts.sys.getCurrentDirectory,
|
||||
useCaseSensitiveFileNames: false,
|
||||
readDirectory: ts.sys.readDirectory,
|
||||
fileExists: ts.sys.fileExists,
|
||||
readFile: ts.sys.readFile,
|
||||
onUnRecoverableConfigFileDiagnostic: undefined,
|
||||
};
|
||||
|
||||
const tsConfig = ts.getParsedCommandLineOfConfigFile(tsConfigPath, ts.getDefaultCompilerOptions(), parseConfigFileHost);
|
||||
|
||||
const compilerOptions: ts.CompilerOptions = tsConfig.options || ts.getDefaultCompilerOptions();
|
||||
|
||||
return compilerOptions;
|
||||
}
|
||||
|
||||
export function getNoEmitOnErrorFromTSConfig(tsConfigPath: string): boolean {
|
||||
const compilerOptions = getCompilerOptionsFromTSConfig(tsConfigPath);
|
||||
const noEmitOnError = !!compilerOptions.noEmitOnError;
|
||||
|
||||
return noEmitOnError;
|
||||
}
|
||||
Reference in New Issue
Block a user