Skip to content

Commit

Permalink
fix: windows output path (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi authored Nov 23, 2024
1 parent f783a6a commit 1c08595
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/plugins/output-state-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Plugin } from 'rollup'
import { type Entries } from '../types'
import path, { posix } from 'path'
import path from 'path'
import prettyBytes from 'pretty-bytes'
import pc from 'picocolors'
import { logger } from '../logger'
Expand Down Expand Up @@ -59,9 +59,9 @@ function createOutputState({ entries }: { entries: Entries }): {
return {
name: 'collect-sizes',
writeBundle(options, bundle) {
const dir = options.dir || posix.dirname(options.file!)
const dir = options.dir || path.dirname(options.file!)
Object.entries(bundle).forEach(([fileName, chunk]) => {
const filePath = posix.join(dir, fileName)
const filePath = path.join(dir, fileName)
if (chunk.type !== 'chunk') {
return
}
Expand All @@ -74,9 +74,7 @@ function createOutputState({ entries }: { entries: Entries }): {
reversedMapping.get(sourceFileName) || '.',
)
addSize({
fileName: path.isAbsolute(cwd)
? posix.relative(cwd, filePath)
: filePath,
fileName: path.relative(cwd, filePath).replace(path.sep, '/'),
size,
sourceFileName,
exportPath,
Expand Down

0 comments on commit 1c08595

Please sign in to comment.