Skip to content

Commit

Permalink
Adds file url support for windows (#50)
Browse files Browse the repository at this point in the history
* Adds file url support for windows

* 2.0.2
  • Loading branch information
a7ul authored Aug 16, 2022
1 parent b91bda1 commit 206652f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
9 changes: 7 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -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<{
Expand All @@ -11,7 +13,10 @@ export type Config = Partial<{
export async function readUserConfig(configPath: string): Promise<Config> {
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."
Expand Down

0 comments on commit 206652f

Please sign in to comment.