diff --git a/compiler/src/interop/src/utils.ts b/compiler/src/interop/src/utils.ts index 7b0a287a9963c60b92aedf56941748867058c237..247f74696f6b13badf4d6c7fe082a9c34578d3db 100644 --- a/compiler/src/interop/src/utils.ts +++ b/compiler/src/interop/src/utils.ts @@ -1303,7 +1303,7 @@ export function removeDecorator(decorators: readonly ts.Decorator[], decoratorNa export function isFileInProject(filePath: string, projectRootPath: string): boolean { const relativeFilePath: string = toUnixPath(path.relative(toUnixPath(projectRootPath), toUnixPath(filePath))); // When processing ohmurl, hsp's filePath is consistent with moduleRequest - return fs.existsSync(filePath) && fs.statSync(filePath).isFile() && !relativeFilePath.startsWith('../'); + return path.isAbsolute(filePath) && fs.existsSync(filePath) && fs.statSync(filePath).isFile() && !relativeFilePath.startsWith('../'); } export function getProjectRootPath(filePath: string, projectConfig: Object, rootPathSet: Object): string { diff --git a/compiler/src/utils.ts b/compiler/src/utils.ts index 7b0a287a9963c60b92aedf56941748867058c237..247f74696f6b13badf4d6c7fe082a9c34578d3db 100644 --- a/compiler/src/utils.ts +++ b/compiler/src/utils.ts @@ -1303,7 +1303,7 @@ export function removeDecorator(decorators: readonly ts.Decorator[], decoratorNa export function isFileInProject(filePath: string, projectRootPath: string): boolean { const relativeFilePath: string = toUnixPath(path.relative(toUnixPath(projectRootPath), toUnixPath(filePath))); // When processing ohmurl, hsp's filePath is consistent with moduleRequest - return fs.existsSync(filePath) && fs.statSync(filePath).isFile() && !relativeFilePath.startsWith('../'); + return path.isAbsolute(filePath) && fs.existsSync(filePath) && fs.statSync(filePath).isFile() && !relativeFilePath.startsWith('../'); } export function getProjectRootPath(filePath: string, projectConfig: Object, rootPathSet: Object): string {