mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2026-02-10 11:40:28 +08:00
fix: use env var for win7 legacy build instead of regex replacement
This commit is contained in:
parent
ab58248d7b
commit
228e2cbffc
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -196,12 +196,9 @@ jobs:
|
||||
run: |
|
||||
pnpm install
|
||||
pnpm add -D electron@22.3.27
|
||||
# Downgrade packages incompatible with Node.js 16 (Electron 22)
|
||||
pnpm add express@4.21.2 chokidar@3.6.0
|
||||
(Get-Content electron-builder.yml) -replace 'windows', 'win7' | Set-Content electron-builder.yml
|
||||
# Electron 22 requires CJS format
|
||||
(Get-Content package.json) -replace '"type": "module"', '"type": "commonjs"' | Set-Content package.json
|
||||
(Get-Content electron.vite.config.ts) -replace 'plugins: \[externalizeDepsPlugin\(\)\]', "plugins: [externalizeDepsPlugin()],`n build: { rollupOptions: { output: { format: 'cjs' } } }" | Set-Content electron.vite.config.ts
|
||||
- name: Update Version for Dev Build
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
env:
|
||||
@ -213,6 +210,7 @@ jobs:
|
||||
env:
|
||||
npm_config_arch: ${{ matrix.arch }}
|
||||
npm_config_target_arch: ${{ matrix.arch }}
|
||||
LEGACY_BUILD: 'true'
|
||||
run: pnpm build:win --${{ matrix.arch }}
|
||||
- name: Add Portable Flag
|
||||
run: |
|
||||
|
||||
@ -15,14 +15,22 @@ const monacoEditorPlugin = isObjectWithDefaultFunction(monacoEditorPluginModule)
|
||||
? monacoEditorPluginModule.default
|
||||
: monacoEditorPluginModule
|
||||
|
||||
// Win7 build: bundle all deps (Vite converts ESM→CJS), only externalize native modules
|
||||
const isLegacyBuild = process.env.LEGACY_BUILD === 'true'
|
||||
const legacyExternal = ['sysproxy-rs', 'electron']
|
||||
|
||||
export default defineConfig({
|
||||
main: {
|
||||
plugins: [externalizeDepsPlugin()]
|
||||
plugins: isLegacyBuild ? [] : [externalizeDepsPlugin()],
|
||||
build: isLegacyBuild
|
||||
? { rollupOptions: { external: legacyExternal, output: { format: 'cjs' } } }
|
||||
: undefined
|
||||
},
|
||||
preload: {
|
||||
plugins: [externalizeDepsPlugin()],
|
||||
plugins: isLegacyBuild ? [] : [externalizeDepsPlugin()],
|
||||
build: {
|
||||
rollupOptions: {
|
||||
external: isLegacyBuild ? legacyExternal : undefined,
|
||||
output: {
|
||||
format: 'cjs',
|
||||
entryFileNames: '[name].cjs'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user