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 pageToHashMap![chunk.name.toLowerCase()] = hash
// inject another chunk with the content stripped // inject another chunk with the content stripped
bundle[name + '-lean'] = { this.emitFile({
...chunk, type: 'asset',
name: name + '-lean',
fileName: chunk.fileName.replace(/\.js$/, '.lean.js'), fileName: chunk.fileName.replace(/\.js$/, '.lean.js'),
preliminaryFileName: chunk.preliminaryFileName.replace( source: chunk.code.replace(staticStripRE, `""`)
/\.js$/, })
'.lean.js'
),
code: chunk.code.replace(staticStripRE, `""`)
}
// remove static markers from original code // remove static markers from original code
chunk.code = chunk.code.replace(staticRestoreRE, '') chunk.code = chunk.code.replace(staticRestoreRE, '')

Loading…
Cancel
Save