From 60c256b6dfc16e8b359dac037f3f650e3fb7eeae Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Sat, 26 Nov 2022 17:48:22 -0600 Subject: [PATCH] fix path issues with node_modules --- src/azle.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/azle.ts b/src/azle.ts index ee71766675..24f5f327c7 100644 --- a/src/azle.ts +++ b/src/azle.ts @@ -21,6 +21,7 @@ import { import { Err, ok, Ok, Result, unwrap } from './result'; import { red, yellow, green, blue, purple, dim } from './colors'; import * as tsc from 'typescript'; +import * as path from 'path'; azle(); @@ -272,11 +273,9 @@ function getFileNames(tsPath: string): string[] { const program = tsc.createProgram([tsPath], {}); const sourceFiles = program.getSourceFiles(); - const root_absolute_path = require('path').join(__dirname, '..'); - const fileNames = sourceFiles.map((sourceFile) => { - if (sourceFile.fileName.startsWith(root_absolute_path) === false) { - return `${process.cwd()}/${sourceFile.fileName}`; + if (!sourceFile.fileName.startsWith('/')) { + return path.join(process.cwd(), sourceFile.fileName); } else { return sourceFile.fileName; }