forked from trent_larson/crowd-funder-for-time-pwa
WIP: add Electron platform configuration to Capacitor
- Add electron platform section to capacitor.config.json - Configure deep linking with timesafari:// scheme - Set up build options for macOS, Windows, and Linux - Configure output directory and file inclusion - Add platform-specific build targets (DMG, NSIS, AppImage) - Support both x64 and arm64 architectures for macOS - Set appropriate app categories for each platform This enables building TimeSafari as a native desktop application using Capacitor's Electron platform while maintaining existing mobile and web functionality.
This commit is contained in:
@@ -13,28 +13,27 @@ const __dirname = path.dirname(__filename);
|
||||
|
||||
export async function createBuildConfig(mode: string): Promise<UserConfig> {
|
||||
const appConfig = await loadAppConfig();
|
||||
const isElectron = mode === "electron";
|
||||
const isCapacitor = mode === "capacitor";
|
||||
const isNative = isElectron || isCapacitor;
|
||||
const isNative = isCapacitor;
|
||||
|
||||
// Explicitly set platform and disable PWA for Electron
|
||||
// Set platform and disable PWA for native platforms
|
||||
process.env.VITE_PLATFORM = mode;
|
||||
process.env.VITE_PWA_ENABLED = isElectron ? 'false' : 'true';
|
||||
process.env.VITE_DISABLE_PWA = isElectron ? 'true' : 'false';
|
||||
process.env.VITE_PWA_ENABLED = isCapacitor ? 'false' : 'true';
|
||||
process.env.VITE_DISABLE_PWA = isCapacitor ? 'true' : 'false';
|
||||
|
||||
if (isElectron || isCapacitor) {
|
||||
if (isCapacitor) {
|
||||
process.env.VITE_PWA_ENABLED = 'false';
|
||||
}
|
||||
|
||||
return {
|
||||
base: isElectron ? "./" : "/",
|
||||
base: "/",
|
||||
plugins: [vue()],
|
||||
server: {
|
||||
port: parseInt(process.env.VITE_PORT || "8080"),
|
||||
fs: { strict: false },
|
||||
},
|
||||
build: {
|
||||
outDir: isElectron ? "dist-electron" : "dist",
|
||||
outDir: "dist",
|
||||
assetsDir: 'assets',
|
||||
chunkSizeWarningLimit: 1000,
|
||||
rollupOptions: {
|
||||
@@ -57,9 +56,9 @@ export async function createBuildConfig(mode: string): Promise<UserConfig> {
|
||||
define: {
|
||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
||||
'process.env.VITE_PLATFORM': JSON.stringify(mode),
|
||||
'process.env.VITE_PWA_ENABLED': JSON.stringify(!isElectron),
|
||||
'process.env.VITE_DISABLE_PWA': JSON.stringify(isElectron),
|
||||
__dirname: isElectron ? JSON.stringify(process.cwd()) : '""',
|
||||
'process.env.VITE_PWA_ENABLED': JSON.stringify(!isCapacitor),
|
||||
'process.env.VITE_DISABLE_PWA': JSON.stringify(isCapacitor),
|
||||
__dirname: JSON.stringify(process.cwd()),
|
||||
__IS_MOBILE__: JSON.stringify(isCapacitor),
|
||||
__USE_QR_READER__: JSON.stringify(!isCapacitor),
|
||||
'process.platform': JSON.stringify('browser'),
|
||||
@@ -88,7 +87,7 @@ export async function createBuildConfig(mode: string): Promise<UserConfig> {
|
||||
'@nostr/tools',
|
||||
'@nostr/tools/nip06',
|
||||
],
|
||||
exclude: isElectron ? [
|
||||
exclude: isCapacitor ? [
|
||||
'register-service-worker',
|
||||
'workbox-window',
|
||||
'web-push',
|
||||
|
||||
Reference in New Issue
Block a user