Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: can't build package on windows #1894

Merged
merged 2 commits into from
May 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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, '/')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use slash package for this case (he is already installed in nextra)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use slash package for this case (he is already installed in nextra)

Edited


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