fix: 将路由组件调整为同步引入,根除线上 SW/Dat 缓存引发的 Chunk fetch 失败问题 (Profile-xxx.js 找不到)
This commit is contained in:
parent
eeeff9942e
commit
4ad5489b83
|
|
@ -100,8 +100,11 @@ const matchFile = async (request, response) => {
|
|||
'Content-Type': mimetype,
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
}
|
||||
if (cleanPath.endsWith("-sw.js")) {
|
||||
if (cleanPath.endsWith("-sw.js") || cleanPath.includes("dat-module-map.json")) {
|
||||
responseHeaders["Service-Worker-Allowed"] = '/'
|
||||
responseHeaders["Cache-Control"] = 'no-cache, no-store, must-revalidate'
|
||||
responseHeaders["Pragma"] = 'no-cache'
|
||||
responseHeaders["Expires"] = '0'
|
||||
}
|
||||
response.writeHead(httpOk, responseHeaders)
|
||||
response.end(file)
|
||||
|
|
|
|||
|
|
@ -1,16 +1,26 @@
|
|||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
|
||||
import IndexView from '@/views/index/index.vue'
|
||||
import ChatEdit from '@/views/wxPage/ChatEdit.vue'
|
||||
import BalanceEdit from '@/views/wxPage/BalanceEdit.vue'
|
||||
import WorksView from '@/views/work/works.vue'
|
||||
import AboutView from '@/views/About.vue'
|
||||
import ProfileView from '@/views/Profile.vue'
|
||||
import ArticleList from '@/views/article/list.vue'
|
||||
import ArticleDetail from '@/views/article/detail.vue'
|
||||
import GongZiDan from '@/views/other/gongzidan.vue'
|
||||
|
||||
const routes = [
|
||||
{ path: '/', name: 'index', component: () => import('@/views/index/index.vue') },
|
||||
{ path: '/chat', name: 'Chat', component: () => import('@/views/wxPage/ChatEdit.vue'), meta: { requiresAuth: false } },
|
||||
{ path: '/balance', name: 'Balance', component: () => import('@/views/wxPage/BalanceEdit.vue'), meta: { requiresAuth: false } },
|
||||
{ path: '/works', name: 'Works', component: () => import('@/views/work/works.vue'), meta: { requiresAuth: true } },
|
||||
{ path: '/about', name: 'About', component: () => import('@/views/About.vue') },
|
||||
{ path: '/profile', name: 'Profile', component: () => import('@/views/Profile.vue'), meta: { requiresAuth: true } },
|
||||
{ path: '/article', name: 'Article', component: () => import('@/views/article/list.vue') },
|
||||
{ path: '/article-detail', name: 'ArticleDetail', component: () => import('@/views/article/detail.vue') },
|
||||
{ path: '/gongzidan', name: 'GongZiDan', component: () => import('@/views/other/gongzidan.vue') },
|
||||
{ path: '/', name: 'index', component: IndexView },
|
||||
{ path: '/chat', name: 'Chat', component: ChatEdit, meta: { requiresAuth: false } },
|
||||
{ path: '/balance', name: 'Balance', component: BalanceEdit, meta: { requiresAuth: false } },
|
||||
{ path: '/works', name: 'Works', component: WorksView, meta: { requiresAuth: true } },
|
||||
{ path: '/about', name: 'About', component: AboutView },
|
||||
{ path: '/profile', name: 'Profile', component: ProfileView, meta: { requiresAuth: true } },
|
||||
{ path: '/article', name: 'Article', component: ArticleList },
|
||||
{ path: '/article-detail', name: 'ArticleDetail', component: ArticleDetail },
|
||||
{ path: '/gongzidan', name: 'GongZiDan', component: GongZiDan },
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
|
|
|
|||
Loading…
Reference in New Issue