@@ -18,6 +18,7 @@ import { dirname, join, relative } from "path";
1818import * as ts from "typescript" ;
1919import { readFileSync , existsSync } from "fs" ;
2020import { collectDeepNodes } from "@ngtools/webpack/src/transformers" ;
21+ import { getCompilerOptionsFromTSConfig } from "./tsconfig-utils" ;
2122
2223export function getMainModulePath ( entryFilePath : string , tsConfigName : string ) {
2324 try {
@@ -43,23 +44,13 @@ export function getMainModulePath(entryFilePath: string, tsConfigName: string) {
4344function tsResolve ( moduleName : string , containingFilePath : string , tsConfigName : string ) {
4445 let result = moduleName ;
4546 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 ( ) ;
5847 const moduleResolutionHost : ts . ModuleResolutionHost = {
5948 fileExists : ts . sys . fileExists ,
6049 readFile : ts . sys . readFile
6150 } ;
6251
52+ const compilerOptions = getCompilerOptionsFromTSConfig ( tsConfigName ) ;
53+
6354 const resolutionResult = ts . resolveModuleName ( moduleName , containingFilePath , compilerOptions , moduleResolutionHost ) ;
6455
6556 if ( resolutionResult && resolutionResult . resolvedModule && resolutionResult . resolvedModule . resolvedFileName ) {
0 commit comments