鍍金池/ 問答/Linux  HTML/ vue webpack loading chunk xx failed.該如何解

vue webpack loading chunk xx failed.該如何解決?

進網(wǎng)站后沒有報錯,數(shù)據(jù)也請求成功,但是只要點其他的鏈接就出現(xiàn)如下報錯!
圖片描述

相關(guān):
"vue": "^2.5.2",
"vue-resource": "^1.3.5",
"vue-router": "^3.0.1",
"webpack": "^3.6.0",

router.index主要代碼

import Vue from 'vue'
import Router from 'vue-router'

const index = () => import('@/components/front/index')
const Home = () => import('@/components/front/Home')
const article = () => import('@/components/front/article')
const SearchResult = () => import('@/components/front/SearchResult')
const Articles = () => import('@/components/front/Articles')
const login = () => import('@/components/back/login')
const admin = () => import('@/components/back/admin')
const posts = () => import('@/components/back/posts')
const editor = () => import('@/components/back/editor')
const drafts = () => import('@/components/back/drafts')
const search = () => import('@/components/back/search')
const account = () => import('@/components/back/account')

const router = new Router({
    mode: 'history',
    scrollBehavior(to, from, savedPosition) {
        if (to.hash) {
            return {
                selector: to.hash
            }
        } else {
            return {x: 0, y: 0}
        }
    },
    routes: [
        {
            path:'/',
            redirect:'home',
            component: index,
            children: [
                {path: 'home', name: 'home', component: Home, meta: {title: '博客首頁'}},
                {path: 'articles', name: 'articles', component: Articles, meta: {title: '學(xué)習(xí)筆記分享'}},
                {path: 'articles/:id', name: 'article', component: article},
                {path: 'search/:text', name: 'SearchResult', component: SearchResult, meta: {title: '搜索結(jié)果'}}
            ]
        },
        {
            path: '/login',
            name: 'login',
            component: login,
            meta: {title: '登錄頁面'}
        },
        {
            path:'/admin',
            redirect:'admin/posts',
            component: admin,
            children: [
                {path:'posts',name:'posts', component: posts, meta:{requireAuth:true, title:'博客文章'}},
                {path:'editor',name:'editor', component: editor, meta:{requireAuth:true, title:'博客編輯'}},
                {path:'drafts',name:'drafts', component: drafts, meta:{requireAuth:true, title:'博客草稿'}},
                {path: 'search', name: 'search', component: search, meta: {requireAuth: true, title: '搜索結(jié)果'}},
                {path: 'account', name: 'account', component: account, meta: {requireAuth: true, title: '修改賬戶'}}
            ]
        }
    ],
})

export default router

項目運行在本地是沒問題的,打包丟到服務(wù)器就出這個問題,請問可能是哪里配置有問題?怎么解決..


JS請求不成功的報錯:那個字體先不管, 這個1.296c763ff4e540ac2581.js 文件不知道哪來的~~我在打包后的/statuc/js里沒找到這個文件
圖片描述

回答
編輯回答
短嘆

1.確認一下你的文件目錄下有沒有這個文件
2.確認一下這個文件的讀寫權(quán)限是啥

2018年5月31日 17:09
編輯回答
傻叼

弄好了... 修改了下nginx配置圖片描述

因為在nginx配置的根目錄/var/www/html下面壓根就沒有l(wèi)oading這個真實目錄存在,這些訪問資源都是在js里渲染的。在nginx配置里添加vue-route的跳轉(zhuǎn)設(shè)置,就ok了。雖然沒完全懂為什么,但確實有效~
原文鏈接:https://www.cnblogs.com/kevin...

2017年5月24日 09:21
編輯回答
淺淺

看你上面,js沒有加載成功

2018年2月20日 19:36