fix(stage-ui,stage-pocket,stage-web,stage-tamagotchi,ui-server-auth): analytics import not deferred or lazied
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import { OnboardingDialog, OnboardingStepAnalyticsNotice, ToasterRoot } from '@proj-airi/stage-ui/components'
|
||||
import { useInferencePreload } from '@proj-airi/stage-ui/composables'
|
||||
import { useAuthProviderSync } from '@proj-airi/stage-ui/composables/use-auth-provider-sync'
|
||||
import { isPosthogAvailableInBuild, useSharedAnalyticsStore } from '@proj-airi/stage-ui/stores/analytics'
|
||||
import { isAnalyticsAvailableInBuild, useSharedAnalyticsStore } from '@proj-airi/stage-ui/stores/analytics'
|
||||
import { useCharacterOrchestratorStore } from '@proj-airi/stage-ui/stores/character'
|
||||
import { useChatSessionStore } from '@proj-airi/stage-ui/stores/chat/session-store'
|
||||
import { useDisplayModelsStore } from '@proj-airi/stage-ui/stores/display-models'
|
||||
@@ -65,7 +65,7 @@ const colors = computed(() => {
|
||||
})
|
||||
|
||||
const onboardingExtraSteps = computed(() => {
|
||||
return isPosthogAvailableInBuild()
|
||||
return isAnalyticsAvailableInBuild()
|
||||
? [{ id: 'analytics-notice', component: OnboardingStepAnalyticsNotice }]
|
||||
: []
|
||||
})
|
||||
|
||||
@@ -8,6 +8,7 @@ import { autoAnimatePlugin } from '@formkit/auto-animate/vue'
|
||||
import { PiniaColada } from '@pinia/colada'
|
||||
import { isEnvTruthy } from '@proj-airi/stage-shared'
|
||||
import { trackButtonPlugin } from '@proj-airi/stage-ui/directives/track-button'
|
||||
import { configureAnalyticsAdapter } from '@proj-airi/stage-ui/stores/analytics/client'
|
||||
import { MotionPlugin } from '@vueuse/motion'
|
||||
import { createPinia } from 'pinia'
|
||||
import { setupLayouts } from 'virtual:generated-layouts'
|
||||
@@ -27,6 +28,11 @@ import 'vue-sonner/style.css'
|
||||
import './styles/main.css'
|
||||
import 'uno.css'
|
||||
|
||||
configureAnalyticsAdapter(async (options) => {
|
||||
const { createPosthogAdapter } = await import('@proj-airi/stage-ui/stores/analytics/posthog')
|
||||
return createPosthogAdapter(options)
|
||||
})
|
||||
|
||||
const pinia = createPinia()
|
||||
|
||||
// TODO: vite-plugin-vue-layouts is long deprecated, replace with another layout solution
|
||||
|
||||
@@ -91,6 +91,23 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
build: {
|
||||
manifest: true,
|
||||
rolldownOptions: {
|
||||
output: {
|
||||
chunkFileNames: (chunkInfo) => {
|
||||
const containsAnalyticsModule = chunkInfo.moduleIds.some((moduleId) => {
|
||||
const normalizedModuleId = moduleId.replaceAll('\\', '/').toLowerCase()
|
||||
return normalizedModuleId.includes('analytics') || normalizedModuleId.includes('posthog')
|
||||
})
|
||||
|
||||
// Only analytics/provider chunks receive the manual neutral mapping;
|
||||
// all unrelated chunks retain Vite's readable default naming.
|
||||
return containsAnalyticsModule
|
||||
? 'assets/auxiliary-[hash].js'
|
||||
: 'assets/[name]-[hash].js'
|
||||
},
|
||||
},
|
||||
},
|
||||
sourcemap: true,
|
||||
},
|
||||
worker: {
|
||||
|
||||
Reference in New Issue
Block a user