perf(front): reduce login page preload and split frontend vendor chunks
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
@@ -225,18 +225,6 @@ function goRegister() {
|
||||
router.push('/register')
|
||||
}
|
||||
|
||||
watch(forgotOpen, async (open) => {
|
||||
if (open && !forgotCaptchaImage.value) {
|
||||
await refreshEmailResetCaptcha()
|
||||
}
|
||||
})
|
||||
|
||||
watch(resendOpen, async (open) => {
|
||||
if (open && !resendCaptchaImage.value) {
|
||||
await refreshResendCaptcha()
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const status = await fetchEmailVerifyStatus()
|
||||
@@ -246,10 +234,6 @@ onMounted(async () => {
|
||||
emailEnabled.value = false
|
||||
registerVerifyEnabled.value = false
|
||||
}
|
||||
|
||||
if (emailEnabled.value) {
|
||||
await Promise.allSettled([refreshEmailResetCaptcha(), refreshResendCaptcha()])
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -13,7 +13,34 @@ export default defineConfig({
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks(id) {
|
||||
if (id.includes('node_modules')) return 'vendor'
|
||||
if (!id.includes('node_modules')) return undefined
|
||||
|
||||
if (
|
||||
id.includes('/node_modules/vue/') ||
|
||||
id.includes('/node_modules/@vue/') ||
|
||||
id.includes('/node_modules/vue-router/') ||
|
||||
id.includes('/node_modules/pinia/')
|
||||
) {
|
||||
return 'vendor-vue'
|
||||
}
|
||||
|
||||
if (id.includes('/node_modules/element-plus/') || id.includes('/node_modules/@element-plus/')) {
|
||||
return 'vendor-element'
|
||||
}
|
||||
|
||||
if (id.includes('/node_modules/axios/')) {
|
||||
return 'vendor-axios'
|
||||
}
|
||||
|
||||
if (
|
||||
id.includes('/node_modules/socket.io-client/') ||
|
||||
id.includes('/node_modules/engine.io-client/') ||
|
||||
id.includes('/node_modules/socket.io-parser/')
|
||||
) {
|
||||
return 'vendor-realtime'
|
||||
}
|
||||
|
||||
return 'vendor-misc'
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user