forked from jsnbuchanan/crowd-funder-for-time-pwa
- Fix Vue template syntax in App.vue by using proper event handler format - Update Vite config to properly handle ESM imports and crypto modules - Add manual chunks for better code splitting - Improve environment variable handling in vite-env.d.ts - Fix TypeScript linting errors in App.vue
56 lines
1.6 KiB
JavaScript
56 lines
1.6 KiB
JavaScript
import * as path from 'path'
|
|
import { promises as fs } from 'fs'
|
|
import { fileURLToPath } from 'url'
|
|
|
|
export async function loadAppConfig() {
|
|
const packageJson = await loadPackageJson()
|
|
const appName = process.env.TIME_SAFARI_APP_TITLE || packageJson.name
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
|
|
return {
|
|
pwaConfig: {
|
|
manifest: {
|
|
name: appName,
|
|
short_name: appName,
|
|
icons: [
|
|
{
|
|
src: './img/icons/android-chrome-192x192.png',
|
|
sizes: '192x192',
|
|
type: 'image/png'
|
|
},
|
|
{
|
|
src: './img/icons/android-chrome-512x512.png',
|
|
sizes: '512x512',
|
|
type: 'image/png'
|
|
},
|
|
{
|
|
src: './img/icons/android-chrome-maskable-192x192.png',
|
|
sizes: '192x192',
|
|
type: 'image/png',
|
|
purpose: 'maskable'
|
|
},
|
|
{
|
|
src: './img/icons/android-chrome-maskable-512x512.png',
|
|
sizes: '512x512',
|
|
type: 'image/png',
|
|
purpose: 'maskable'
|
|
}
|
|
]
|
|
}
|
|
},
|
|
aliasConfig: {
|
|
'@': path.resolve(path.dirname(__dirname), 'src'),
|
|
buffer: path.resolve(path.dirname(__dirname), 'node_modules', 'buffer'),
|
|
'dexie-export-import/dist/import':
|
|
'dexie-export-import/dist/import/index.js'
|
|
}
|
|
}
|
|
}
|
|
|
|
async function loadPackageJson() {
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
const packageJsonPath = path.resolve(path.dirname(__dirname), 'package.json')
|
|
const packageJsonData = await fs.readFile(packageJsonPath, 'utf-8')
|
|
return JSON.parse(packageJsonData)
|
|
}
|