Skip to content

Commit

Permalink
chore: replace winPath with slash
Browse files Browse the repository at this point in the history
  • Loading branch information
AkaraChen committed May 23, 2023
1 parent 5dafd88 commit f6ebd07
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/nextra/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineConfig } from 'tsup'
import fs from 'node:fs/promises'
import path from 'node:path'
import fg from 'fast-glob'
import slash from 'slash'

import tsconfig from './tsconfig.json'

Expand All @@ -14,8 +15,6 @@ const CLIENT_ENTRY = [
const entries = fg.sync(CLIENT_ENTRY, { absolute: true })
const entriesSet = new Set(entries)

const winPath = (p: string) => p.replace(/\\/g, '/')

const sharedConfig = defineConfig({
// import.meta is available only from es2020
target: 'es2020',
Expand All @@ -35,14 +34,14 @@ const sharedConfig = defineConfig({
!args.path.endsWith('.json')
) {
let isDir: boolean
const importPath = winPath(path.join(args.resolveDir, args.path))
const importPath = slash(path.join(args.resolveDir, args.path))
try {
isDir = (await fs.stat(importPath)).isDirectory()
} catch {
isDir = false
}

const isClientImporter = entriesSet.has(winPath(args.importer))
const isClientImporter = entriesSet.has(slash(args.importer))

if (isClientImporter) {
const isClientImport = entries.some(entry =>
Expand Down

0 comments on commit f6ebd07

Please sign in to comment.