vite-jsconfig-paths
Version:
Vite resolver for JavaScript compilerOptions.paths
22 lines (15 loc) • 552 B
text/typescript
import * as os from 'os'
import * as path from 'path'
import { normalizePath } from 'vite'
const isWindows = os.platform() === 'win32'
export const resolve = isWindows
? (...paths: string[]) => normalizePath(path.win32.resolve(...paths))
: path.posix.resolve
export const isAbsolute = isWindows
? path.win32.isAbsolute
: path.posix.isAbsolute
/** Only call this on normalized paths */
export const join = path.posix.join
/** Only call this on normalized paths */
export const relative = path.posix.relative
export { dirname } from 'path'