Replace vue-toast-notification with custom useAppToast across components and enhance Edge Gateway installer state management.
This commit is contained in:
+30
-6
@@ -1,9 +1,10 @@
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vueDevTools from 'vite-plugin-vue-devtools'
|
||||
import { viteSingleFile } from 'vite-plugin-singlefile'
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
import VueJsx from '@vitejs/plugin-vue-jsx'
|
||||
import { execSync } from 'node:child_process'
|
||||
|
||||
@@ -60,10 +61,28 @@ function patchBuefyCssMediaQuery() {
|
||||
}
|
||||
}
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
async function loadVitePwaPlugin(workspaceRoot) {
|
||||
const localPluginEntry = path.resolve(workspaceRoot, 'node_modules.external-link', 'vite-plugin-pwa', 'dist', 'index.js')
|
||||
|
||||
try {
|
||||
if (fs.existsSync(localPluginEntry)) {
|
||||
return await import(pathToFileURL(localPluginEntry).href)
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Failed to load vite-plugin-pwa from node_modules.external-link:', error.message)
|
||||
}
|
||||
|
||||
console.warn('vite-plugin-pwa is unavailable; continuing without PWA support in this environment.')
|
||||
return null
|
||||
}
|
||||
|
||||
export default defineConfig(async ({ mode }) => {
|
||||
const isProd = mode === 'production'
|
||||
const isPlaywrightRuntime = process.env.PLAYWRIGHT === '1'
|
||||
const shouldDisableDepOptimizer = process.platform === 'win32'
|
||||
const workspaceRoot = process.cwd()
|
||||
const vitePwaModule = await loadVitePwaPlugin(workspaceRoot)
|
||||
const VitePWA = vitePwaModule?.VitePWA
|
||||
|
||||
// Set COMMIT_HASH env var for use in the app
|
||||
const version = process.env.npm_package_version || '0.0.0'
|
||||
@@ -106,7 +125,7 @@ export default defineConfig(({ mode }) => {
|
||||
VueJsx(),
|
||||
!isProd && !isPlaywrightRuntime && vueDevTools(),
|
||||
enableSingleFile && viteSingleFile(),
|
||||
VitePWA({
|
||||
VitePWA && VitePWA({
|
||||
registerType: 'autoUpdate',
|
||||
injectRegister: isProd ? 'auto' : false,
|
||||
strategies: 'generateSW',
|
||||
@@ -222,11 +241,16 @@ export default defineConfig(({ mode }) => {
|
||||
ignored: ['**/output/playwright/**']
|
||||
}
|
||||
},
|
||||
optimizeDeps: isPlaywrightRuntime
|
||||
optimizeDeps: shouldDisableDepOptimizer
|
||||
? {
|
||||
entries: ['index.html']
|
||||
noDiscovery: true,
|
||||
include: []
|
||||
}
|
||||
: undefined
|
||||
: isPlaywrightRuntime
|
||||
? {
|
||||
entries: ['index.html']
|
||||
}
|
||||
: undefined
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user