Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
TheUltDev authored Jan 2, 2024
1 parent ad93913 commit e76407b
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { resolve } from 'node:path'
import { platform } from 'node:os'
import { pathToFileURL } from 'node:url'

import {
Config,
Expand All @@ -17,6 +18,8 @@ import { importFresh } from '../import-fresh.js'
import { esbuildCssModulesPlugin } from './esbuild-css-modules-plugin.js'
import { esbuildPreactCompatPlugin } from './esbuild-preact-compat-plugin.js'

const isWindows = platform() === 'win32';

interface EntryFile extends ConfigFile {
commandId: string
}
Expand Down Expand Up @@ -53,8 +56,8 @@ async function overrideEsbuildConfigAsync(
if (filePaths.length === 0) {
return buildOptions
}
if (platform() === 'win32') {
filePaths = filePaths.map(p => `file:///${p}`);
if (isWindows) {
filePaths = filePaths.map(p => pathToFileURL(p).href);
}
const overrideEsbuildConfig:
| OverrideEsbuildConfig
Expand Down

0 comments on commit e76407b

Please sign in to comment.