Skip to content

Commit

Permalink
fix: print error file path when using rollupOptions.output.dir (fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
qmhc authored Aug 16, 2022
1 parent 15ff3a2 commit 3bffd14
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/vite/src/node/plugins/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,12 @@ export function buildReporterPlugin(config: ResolvedConfig): Plugin {
content: string | Uint8Array,
type: WriteType,
maxLength: number,
outDir = config.build.outDir,
compressedSize = ''
) {
const outDir =
outDir =
normalizePath(
path.relative(
config.root,
path.resolve(config.root, config.build.outDir)
)
path.relative(config.root, path.resolve(config.root, outDir))
) + '/'
const kibs = content.length / 1024
const sizeColor = kibs > chunkLimit ? colors.yellow : colors.dim
Expand Down Expand Up @@ -137,7 +135,7 @@ export function buildReporterPlugin(config: ResolvedConfig): Plugin {
}
},

async writeBundle(_, output) {
async writeBundle({ dir: outDir }, output) {
let hasLargeChunks = false

if (shouldLogInfo) {
Expand All @@ -161,14 +159,16 @@ export function buildReporterPlugin(config: ResolvedConfig): Plugin {
chunk.code,
WriteType.JS,
longest,
outDir,
await getCompressedSize(chunk.code)
)
if (chunk.map) {
printFileInfo(
chunk.fileName + '.map',
chunk.map.toString(),
WriteType.SOURCE_MAP,
longest
longest,
outDir
)
}
}
Expand All @@ -190,6 +190,7 @@ export function buildReporterPlugin(config: ResolvedConfig): Plugin {
? WriteType.SOURCE_MAP
: WriteType.ASSET,
longest,
outDir,
isCSS ? await getCompressedSize(chunk.source) : undefined
)
}
Expand Down

0 comments on commit 3bffd14

Please sign in to comment.