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