Skip to content

Commit 206652f

Browse files
authored
Adds file url support for windows (#50)
* Adds file url support for windows * 2.0.2
1 parent b91bda1 commit 206652f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "esbuild-node-tsc",
33
"description": "Build your Typescript Node.js projects using blazing fast esbuild",
4-
"version": "2.0.1",
4+
"version": "2.0.2",
55
"main": "./dist/index.js",
66
"bin": {
77
"esbuild-node-tsc": "dist/index.js",

src/config.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import fs from "fs";
1+
import fs from "node:fs";
2+
import path from "node:path";
3+
import url from "node:url";
24
import type { BuildOptions as EsBuildOptions } from "esbuild";
35

46
export type Config = Partial<{
@@ -11,7 +13,10 @@ export type Config = Partial<{
1113
export async function readUserConfig(configPath: string): Promise<Config> {
1214
if (fs.existsSync(configPath)) {
1315
try {
14-
const { default: config } = await import(configPath);
16+
const configPathUrl = path.isAbsolute(configPath)
17+
? url.pathToFileURL(configPath).toString()
18+
: configPath;
19+
const { default: config } = await import(configPathUrl);
1520
if (config.outDir) {
1621
console.warn(
1722
"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."

0 commit comments

Comments
 (0)