运行:http://localhost:3333/
报错内容:
> vue-todo@1.0.0 dev:server J:\vue-todo
> cross-env NODE_ENV=development node server/server.js
服务在监听0.0.0.0:3333
新的bundle生成
后台请求过程/
启动服务器时就会仅仅执行一次,比路由回调还优先
.vue局部 进入路由前
后台请求过程/bundle.f17cc3d8.js
后台请求过程/1.bundle.f17cc3d8.js
启动服务器时就会仅仅执行一次,比路由回调还优先
Error: no component matched
at server-enter.js:519:31
at AbstractHistory.onReady (J:\vue-todo\node_modules\vue-router\dist\vue-router.common.js:1851:5)
at VueRouter.onReady (J:\vue-todo\node_modules\vue-router\dist\vue-router.common.js:2523:16)
at server-enter.js:516:16
at new Promise (<anonymous>)
at module.exports../client/server-enter.js.exports.default (client/server-enter.js:5:11)
at J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9256:43
at new Promise (<anonymous>)
at J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9253:14
at Object.renderToString (J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9445:9)
Error: no component matched
at server-enter.js:519:31
at AbstractHistory.onReady (J:\vue-todo\node_modules\vue-router\dist\vue-router.common.js:1851:5)
at VueRouter.onReady (J:\vue-todo\node_modules\vue-router\dist\vue-router.common.js:2523:16)
at server-enter.js:516:16
at new Promise (<anonymous>)
at module.exports../client/server-enter.js.exports.default (client/server-enter.js:5:11)
at J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9256:43
at new Promise (<anonymous>)
at J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9253:14
at Object.renderToString (J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9445:9)
启动服务器时就会仅仅执行一次,比路由回调还优先
Error: no component matched
at server-enter.js:519:31
at AbstractHistory.onReady (J:\vue-todo\node_modules\vue-router\dist\vue-router.common.js:1851:5)
at VueRouter.onReady (J:\vue-todo\node_modules\vue-router\dist\vue-router.common.js:2523:16)
at server-enter.js:516:16
at new Promise (<anonymous>)
at module.exports../client/server-enter.js.exports.default (client/server-enter.js:5:11)
at J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9256:43
at new Promise (<anonymous>)
at J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9253:14
at Object.renderToString (J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9445:9)
Error: no component matched
at server-enter.js:519:31
at AbstractHistory.onReady (J:\vue-todo\node_modules\vue-router\dist\vue-router.common.js:1851:5)
at VueRouter.onReady (J:\vue-todo\node_modules\vue-router\dist\vue-router.common.js:2523:16)
at server-enter.js:516:16
at new Promise (<anonymous>)
at module.exports../client/server-enter.js.exports.default (client/server-enter.js:5:11)
at J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9256:43
at new Promise (<anonymous>)
at J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9253:14
at Object.renderToString (J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9445:9)
后台请求过程/favicon.ico
启动服务器时就会仅仅执行一次,比路由回调还优先
Error: no component matched
at server-enter.js:519:31
at AbstractHistory.onReady (J:\vue-todo\node_modules\vue-router\dist\vue-router.common.js:1851:5)
at VueRouter.onReady (J:\vue-todo\node_modules\vue-router\dist\vue-router.common.js:2523:16)
at server-enter.js:516:16
at new Promise (<anonymous>)
at module.exports../client/server-enter.js.exports.default (client/server-enter.js:5:11)
at J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9256:43
at new Promise (<anonymous>)
at J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9253:14
at Object.renderToString (J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9445:9)
Error: no component matched
at server-enter.js:519:31
at AbstractHistory.onReady (J:\vue-todo\node_modules\vue-router\dist\vue-router.common.js:1851:5)
at VueRouter.onReady (J:\vue-todo\node_modules\vue-router\dist\vue-router.common.js:2523:16)
at server-enter.js:516:16
at new Promise (<anonymous>)
at module.exports../client/server-enter.js.exports.default (client/server-enter.js:5:11)
at J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9256:43
at new Promise (<anonymous>)
at J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9253:14
at Object.renderToString (J:\vue-todo\node_modules\vue-server-renderer\build.dev.js:9445:9)
server-enter.js代码:
import createApp from './create-app'
export default context =>{
return new Promise((resolve,reject)=>{
const {app,router}=createApp();
router.push(context.url)
router.onReady(()=>{
const matchedComponents =router.getMatchedComponents()
if(!matchedComponents.length){
return reject(new Error('no component matched'))
}
resolve(app)
})
})
}
create-app.js代码:
import Vue from 'vue'
import Vuex from 'vuex'
import App from './app.vue'
import VueRouter from 'vue-router'
import createRoute from './routers/router'
import createStore from './store/store'
require('./assets/styles/global.css')
Vue.use(VueRouter);
Vue.use(Vuex);
export default ()=>{
const router=createRoute()
const store=createStore()
const app=new Vue({
router,
store,
render:h=>h(App)
});
return {app,router,store}
}