Skip to content

Commit ae0d52d

Browse files
authored
refactor: avoid assigning to bundle object (#4647)
1 parent 63079bf commit ae0d52d

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/node/plugin.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -366,15 +366,12 @@ export async function createVitePressPlugin(
366366
pageToHashMap![chunk.name.toLowerCase()] = hash
367367

368368
// inject another chunk with the content stripped
369-
bundle[name + '-lean'] = {
370-
...chunk,
369+
this.emitFile({
370+
type: 'asset',
371+
name: name + '-lean',
371372
fileName: chunk.fileName.replace(/\.js$/, '.lean.js'),
372-
preliminaryFileName: chunk.preliminaryFileName.replace(
373-
/\.js$/,
374-
'.lean.js'
375-
),
376-
code: chunk.code.replace(staticStripRE, `""`)
377-
}
373+
source: chunk.code.replace(staticStripRE, `""`)
374+
})
378375

379376
// remove static markers from original code
380377
chunk.code = chunk.code.replace(staticRestoreRE, '')

0 commit comments

Comments
 (0)