refactor: avoid assigning to bundle object

pull/4647/head
sapphi-red 6 months ago
parent 63079bff03
commit de725a0933
No known key found for this signature in database
GPG Key ID: B5533BC1E6C4ED51

@ -366,15 +366,12 @@ export async function createVitePressPlugin(
pageToHashMap![chunk.name.toLowerCase()] = hash
// inject another chunk with the content stripped
bundle[name + '-lean'] = {
...chunk,
this.emitFile({
type: 'asset',
name: name + '-lean',
fileName: chunk.fileName.replace(/\.js$/, '.lean.js'),
preliminaryFileName: chunk.preliminaryFileName.replace(
/\.js$/,
'.lean.js'
),
code: chunk.code.replace(staticStripRE, `""`)
}
source: chunk.code.replace(staticStripRE, `""`)
})
// remove static markers from original code
chunk.code = chunk.code.replace(staticRestoreRE, '')

Loading…
Cancel
Save