refactor: avoid assigning to bundle object (#4647)

pull/4648/head
翠 / green 6 months ago committed by GitHub
parent 63079bff03
commit ae0d52d999
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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