You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
48 lines
1.3 KiB
import { defineConfig, mergeConfig } from "vite";
|
|
import { createBuildConfig } from "./vite.config.common.mts";
|
|
|
|
export default defineConfig(async () => {
|
|
const baseConfig = await createBuildConfig('electron');
|
|
|
|
return mergeConfig(baseConfig, {
|
|
plugins: [{
|
|
name: 'remove-sw-imports',
|
|
transform(code: string, id: string) {
|
|
if (
|
|
id.includes('registerServiceWorker') ||
|
|
id.includes('register-service-worker') ||
|
|
id.includes('sw_scripts') ||
|
|
id.includes('PushNotificationPermission') ||
|
|
code.includes('navigator.serviceWorker')
|
|
) {
|
|
return {
|
|
code: code
|
|
.replace(/import.*registerServiceWorker.*$/mg, '')
|
|
.replace(/import.*register-service-worker.*$/mg, '')
|
|
.replace(/navigator\.serviceWorker/g, 'undefined')
|
|
.replace(/if\s*\([^)]*serviceWorker[^)]*\)\s*{[^}]*}/g, '')
|
|
};
|
|
}
|
|
}
|
|
}],
|
|
build: {
|
|
outDir: 'dist-electron',
|
|
emptyOutDir: true,
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
vendor: ['vue', 'vue-router', 'pinia']
|
|
}
|
|
}
|
|
},
|
|
assetsDir: 'assets',
|
|
minify: 'terser',
|
|
terserOptions: {
|
|
compress: {
|
|
drop_console: false,
|
|
},
|
|
},
|
|
},
|
|
base: './',
|
|
});
|
|
});
|