Skip to content

Commit

Permalink
fix(core): cannot import web resources on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Nov 7, 2024
1 parent 03d4e74 commit 986affa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/lib/watch.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import esbuild = require('esbuild');
import _path = require('path');
import fs = require('fs');
import url = require('url');
import _url = require('url');
import type { Config } from '@tsslint/config';

export async function watchConfigFile(
Expand All @@ -21,7 +21,7 @@ export async function watchConfigFile(
let config: Config | undefined;
if (!result.errors.length) {
try {
config = (await import(url.pathToFileURL(outFile).toString() + '?time=' + Date.now())).default;
config = (await import(_url.pathToFileURL(outFile).toString() + '?time=' + Date.now())).default;
} catch (e) {
result.errors.push({ text: String(e) } as any);
}
Expand Down Expand Up @@ -57,7 +57,7 @@ export async function watchConfigFile(
fs.writeFileSync(cachePath, text, 'utf8');
}
return {
path: cachePath,
path: _url.pathToFileURL(cachePath).toString(),
external: true,
};
});
Expand All @@ -67,7 +67,7 @@ export async function watchConfigFile(
const maybeJsPath = require.resolve(path, { paths: [resolveDir] });
if (!isTsFile(maybeJsPath) && fs.existsSync(maybeJsPath)) {
return {
path: url.pathToFileURL(maybeJsPath).toString(),
path: _url.pathToFileURL(maybeJsPath).toString(),
external: true,
};
}
Expand Down

0 comments on commit 986affa

Please sign in to comment.