perf: import some modules dynamically #3179
|
@ -37,8 +37,6 @@ import NoAuthWrapper from '@/components/misc/no-auth-wrapper.vue'
|
||||||
import Ready from '@/components/misc/ready.vue'
|
import Ready from '@/components/misc/ready.vue'
|
||||||
|
|
||||||
|
|||||||
import {setLanguage} from '@/i18n'
|
import {setLanguage} from '@/i18n'
|
||||||
import AccountDeleteService from '@/services/accountDelete'
|
|
||||||
import {success} from '@/message'
|
|
||||||
|
|
||||||
import {useAuthStore} from '@/stores/auth'
|
import {useAuthStore} from '@/stores/auth'
|
||||||
import {useBaseStore} from '@/stores/base'
|
import {useBaseStore} from '@/stores/base'
|
||||||
|
@ -48,6 +46,9 @@ import {useBodyClass} from '@/composables/useBodyClass'
|
||||||
import AddToHomeScreen from '@/components/home/AddToHomeScreen.vue'
|
import AddToHomeScreen from '@/components/home/AddToHomeScreen.vue'
|
||||||
import DemoMode from '@/components/home/DemoMode.vue'
|
import DemoMode from '@/components/home/DemoMode.vue'
|
||||||
|
|
||||||
|
const importAccountDeleteService = () => import('@/services/accountDelete')
|
||||||
|
const importMessage = () => import('@/message')
|
||||||
|
|
||||||
const baseStore = useBaseStore()
|
const baseStore = useBaseStore()
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
@ -68,8 +69,11 @@ watch(accountDeletionConfirm, async (accountDeletionConfirm) => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const messageP = importMessage()
|
||||||
|
const AccountDeleteService = (await importAccountDeleteService()).default
|
||||||
const accountDeletionService = new AccountDeleteService()
|
const accountDeletionService = new AccountDeleteService()
|
||||||
await accountDeletionService.confirm(accountDeletionConfirm)
|
await accountDeletionService.confirm(accountDeletionConfirm)
|
||||||
|
const {success} = await messageP
|
||||||
success({message: t('user.deletion.confirmSuccess')})
|
success({message: t('user.deletion.confirmSuccess')})
|
||||||
authStore.refreshUserInfo()
|
authStore.refreshUserInfo()
|
||||||
}, { immediate: true })
|
}, { immediate: true })
|
||||||
|
|
Reference in New Issue
Block a user
Independent from my other comment:
We try to collect all imports in the beginning of the file even if they are dynamic.
This makes it easier to switch between a normal and a dynamic import.
You can find an example of this in the router.
Please see if the new change is ok.