refactor: replace URL.pathname with fileURLToPath for cross-platform … (#581)

Co-authored-by: dhassoun <david@muxd.com>
This commit is contained in:
David Hassoun
2026-02-23 08:49:14 -06:00
committed by GitHub
co-authored by dhassoun
parent 8763a57360
commit ba17f34091
2 changed files with 6 additions and 4 deletions
@@ -1,7 +1,8 @@
import { readdirSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'tsdown';
const defineDir = new URL('./src/define', import.meta.url).pathname;
const defineDir = fileURLToPath(new URL('./src/define', import.meta.url));
const defineFiles = readdirSync(defineDir).filter(file => file.endsWith('.ts'));
export default defineConfig({
@@ -22,7 +23,7 @@ export default defineConfig({
sourcemap: true,
clean: true,
alias: {
'@': new URL('./src', import.meta.url).pathname,
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
dts: {
oxc: true,
@@ -1,8 +1,9 @@
import { existsSync, readdirSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'tsdown';
import buildStyles from './build/build-styles.ts';
const GENERATED_ICONS_DIR = new URL('./src/icons/generated-icons', import.meta.url).pathname;
const GENERATED_ICONS_DIR = fileURLToPath(new URL('./src/icons/generated-icons', import.meta.url));
function hasGeneratedIcons(): boolean {
if (!existsSync(GENERATED_ICONS_DIR)) return false;
@@ -23,7 +24,7 @@ export default defineConfig({
sourcemap: true,
clean: true,
alias: {
'@': new URL('./src', import.meta.url).pathname,
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
dts: {
oxc: true,