@@ -18,6 +18,7 @@ import { dirname, join, relative } from "path";
18
18
import * as ts from "typescript" ;
19
19
import { readFileSync , existsSync } from "fs" ;
20
20
import { collectDeepNodes } from "@ngtools/webpack/src/transformers" ;
21
+ import { getCompilerOptionsFromTSConfig } from "./tsconfig-utils" ;
21
22
22
23
export function getMainModulePath ( entryFilePath : string , tsConfigName : string ) {
23
24
try {
@@ -43,23 +44,13 @@ export function getMainModulePath(entryFilePath: string, tsConfigName: string) {
43
44
function tsResolve ( moduleName : string , containingFilePath : string , tsConfigName : string ) {
44
45
let result = moduleName ;
45
46
try {
46
- const parseConfigFileHost : ts . ParseConfigFileHost = {
47
- getCurrentDirectory : ts . sys . getCurrentDirectory ,
48
- useCaseSensitiveFileNames : false ,
49
- readDirectory : ts . sys . readDirectory ,
50
- fileExists : ts . sys . fileExists ,
51
- readFile : ts . sys . readFile ,
52
- onUnRecoverableConfigFileDiagnostic : undefined
53
- } ;
54
-
55
- const tsConfig = ts . getParsedCommandLineOfConfigFile ( tsConfigName , ts . getDefaultCompilerOptions ( ) , parseConfigFileHost ) ;
56
-
57
- const compilerOptions : ts . CompilerOptions = tsConfig . options || ts . getDefaultCompilerOptions ( ) ;
58
47
const moduleResolutionHost : ts . ModuleResolutionHost = {
59
48
fileExists : ts . sys . fileExists ,
60
49
readFile : ts . sys . readFile
61
50
} ;
62
51
52
+ const compilerOptions = getCompilerOptionsFromTSConfig ( tsConfigName ) ;
53
+
63
54
const resolutionResult = ts . resolveModuleName ( moduleName , containingFilePath , compilerOptions , moduleResolutionHost ) ;
64
55
65
56
if ( resolutionResult && resolutionResult . resolvedModule && resolutionResult . resolvedModule . resolvedFileName ) {
0 commit comments