Skip to content

Commit

Permalink
fix: can't build package on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
AkaraChen committed May 23, 2023
1 parent 9d6d792 commit 634ae91
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/nextra/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ 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 @@ -33,14 +35,14 @@ const sharedConfig = defineConfig({
!args.path.endsWith('.json')
) {
let isDir: boolean
const importPath = path.join(args.resolveDir, args.path)
const importPath = winPath(path.join(args.resolveDir, args.path))
try {
isDir = (await fs.stat(importPath)).isDirectory()
} catch {
isDir = false
}

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

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

0 comments on commit 634ae91

Please sign in to comment.