mirror of
https://github.com/alex8088/electron-vite.git
synced 2025-11-10 22:43:34 +08:00
fix: avoid duplicate chunk emission
This commit is contained in:
parent
ae57b2489a
commit
7c7f31b2a3
@ -48,7 +48,7 @@ export default function isolateEntriesPlugin(userConfig: InlineConfig): Plugin {
|
|||||||
const re = await bundleEntryFile(entry, userConfig, this.meta.watchMode)
|
const re = await bundleEntryFile(entry, userConfig, this.meta.watchMode)
|
||||||
const outputChunks = re.bundles.output
|
const outputChunks = re.bundles.output
|
||||||
for (const chunk of outputChunks) {
|
for (const chunk of outputChunks) {
|
||||||
if (chunk.type === 'asset' && assetCache.has(chunk.fileName)) {
|
if (assetCache.has(chunk.fileName)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
this.emitFile({
|
this.emitFile({
|
||||||
@ -56,10 +56,8 @@ export default function isolateEntriesPlugin(userConfig: InlineConfig): Plugin {
|
|||||||
fileName: chunk.fileName,
|
fileName: chunk.fileName,
|
||||||
source: chunk.type === 'chunk' ? chunk.code : chunk.source
|
source: chunk.type === 'chunk' ? chunk.code : chunk.source
|
||||||
})
|
})
|
||||||
if (chunk.type === 'asset') {
|
|
||||||
assetCache.add(chunk.fileName)
|
assetCache.add(chunk.fileName)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for (const id of re.watchFiles) {
|
for (const id of re.watchFiles) {
|
||||||
watchFiles.add(id)
|
watchFiles.add(id)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ export default function modulePathPlugin(config: InlineConfig): Plugin {
|
|||||||
source: outputChunk.code
|
source: outputChunk.code
|
||||||
})
|
})
|
||||||
for (const chunk of outputChunks) {
|
for (const chunk of outputChunks) {
|
||||||
if (chunk.type === 'asset' && assetCache.has(chunk.fileName)) {
|
if (assetCache.has(chunk.fileName)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
this.emitFile({
|
this.emitFile({
|
||||||
@ -39,10 +39,8 @@ export default function modulePathPlugin(config: InlineConfig): Plugin {
|
|||||||
fileName: chunk.fileName,
|
fileName: chunk.fileName,
|
||||||
source: chunk.type === 'chunk' ? chunk.code : chunk.source
|
source: chunk.type === 'chunk' ? chunk.code : chunk.source
|
||||||
})
|
})
|
||||||
if (chunk.type === 'asset') {
|
|
||||||
assetCache.add(chunk.fileName)
|
assetCache.add(chunk.fileName)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for (const id of re.watchFiles) {
|
for (const id of re.watchFiles) {
|
||||||
this.addWatchFile(id)
|
this.addWatchFile(id)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user