diff --git a/package.json b/package.json index acbfb5b..2adda9b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "esbuild-node-tsc", "description": "Build your Typescript Node.js projects using blazing fast esbuild", - "version": "2.0.1", + "version": "2.0.2", "main": "./dist/index.js", "bin": { "esbuild-node-tsc": "dist/index.js", diff --git a/src/config.ts b/src/config.ts index 7acb85a..814ebfe 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,4 +1,6 @@ -import fs from "fs"; +import fs from "node:fs"; +import path from "node:path"; +import url from "node:url"; import type { BuildOptions as EsBuildOptions } from "esbuild"; export type Config = Partial<{ @@ -11,7 +13,10 @@ export type Config = Partial<{ export async function readUserConfig(configPath: string): Promise { if (fs.existsSync(configPath)) { try { - const { default: config } = await import(configPath); + const configPathUrl = path.isAbsolute(configPath) + ? url.pathToFileURL(configPath).toString() + : configPath; + const { default: config } = await import(configPathUrl); if (config.outDir) { console.warn( "Your etsc config file is using the old v1.0 format. Please update to the new v2.0 format. Check https://github.com/a7ul/esbuild-node-tsc for details."