mirror of
https://github.com/alex8088/electron-vite.git
synced 2026-04-29 17:28:15 +08:00
Compare commits
3 Commits
a57948710d
...
7feae64e7e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7feae64e7e | ||
|
|
78a117d5be | ||
|
|
deed6f5891 |
@ -69,6 +69,8 @@ export function getElectronNodeTarget(): string {
|
||||
const electronVer = getElectronMajorVer()
|
||||
|
||||
const nodeVer = {
|
||||
'41': '24.14',
|
||||
'40': '24.14',
|
||||
'39': '22.20',
|
||||
'38': '22.19',
|
||||
'37': '22.16',
|
||||
@ -100,6 +102,8 @@ export function getElectronChromeTarget(): string {
|
||||
const electronVer = getElectronMajorVer()
|
||||
|
||||
const chromeVer = {
|
||||
'41': '146',
|
||||
'40': '144',
|
||||
'39': '142',
|
||||
'38': '140',
|
||||
'37': '138',
|
||||
|
||||
@ -143,7 +143,7 @@ const bytecodeModuleLoaderCode = [
|
||||
const bytecodeChunkExtensionRE = /.(jsc|cjsc)$/
|
||||
|
||||
export interface BytecodeOptions {
|
||||
chunkAlias?: string | string[]
|
||||
chunkAlias?: string | string[] | RegExp
|
||||
transformArrowFunctions?: boolean
|
||||
removeBundleJS?: boolean
|
||||
protectedStrings?: string[]
|
||||
@ -160,11 +160,13 @@ export function bytecodePlugin(options: BytecodeOptions = {}): Plugin | null {
|
||||
}
|
||||
|
||||
const { chunkAlias = [], transformArrowFunctions = true, removeBundleJS = true, protectedStrings = [] } = options
|
||||
const _chunkAlias = Array.isArray(chunkAlias) ? chunkAlias : [chunkAlias]
|
||||
const _chunkAlias = chunkAlias instanceof RegExp ? chunkAlias : Array.isArray(chunkAlias) ? chunkAlias : [chunkAlias]
|
||||
|
||||
const transformAllChunks = _chunkAlias.length === 0
|
||||
const isBytecodeChunk = (chunkName: string): boolean => {
|
||||
return transformAllChunks || _chunkAlias.some(alias => alias === chunkName)
|
||||
if (_chunkAlias instanceof RegExp) {
|
||||
return _chunkAlias.test(chunkName)
|
||||
}
|
||||
return _chunkAlias.length === 0 || _chunkAlias.some(alias => alias === chunkName)
|
||||
}
|
||||
|
||||
const plugins: babel.PluginItem[] = []
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user