mirror of
https://github.com/alex8088/electron-vite.git
synced 2026-04-29 17:28:15 +08:00
refactor: ?modulePath sub-build output strategy
This commit is contained in:
parent
2f1f389776
commit
fa84b6d6c3
@ -1,4 +1,3 @@
|
|||||||
import path from 'node:path'
|
|
||||||
import { type Plugin, type InlineConfig, type Rolldown, build as viteBuild, mergeConfig } from 'vite'
|
import { type Plugin, type InlineConfig, type Rolldown, build as viteBuild, mergeConfig } from 'vite'
|
||||||
import MagicString from 'magic-string'
|
import MagicString from 'magic-string'
|
||||||
import { cleanUrl, toRelativePath } from '../utils'
|
import { cleanUrl, toRelativePath } from '../utils'
|
||||||
@ -100,9 +99,10 @@ async function bundleEntryFile(input: string, config: InlineConfig): Promise<Rol
|
|||||||
{
|
{
|
||||||
name: 'vite:entry-file-name',
|
name: 'vite:entry-file-name',
|
||||||
outputOptions(output): Rolldown.OutputOptions {
|
outputOptions(output): Rolldown.OutputOptions {
|
||||||
if (typeof output.entryFileNames !== 'function' && output.entryFileNames) {
|
// Prevent output conflicts
|
||||||
output.entryFileNames = '[name]-[hash]' + path.extname(output.entryFileNames)
|
output.hashCharacters = 'hex'
|
||||||
}
|
// Assign chunkFileNames to entryFileNames to treat sub-entries as internal chunks
|
||||||
|
output.entryFileNames = output.chunkFileNames
|
||||||
return output
|
return output
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user