解决编译后加载顺序异常的went

This commit is contained in:
yi-ge 2018-11-11 23:57:03 +08:00
parent 699297877a
commit 00006ed146

View File

@ -38,9 +38,6 @@ module.exports = app => {
template,
clientManifest
})
const API = require('../dist/api/api').default
const server = API(app)
resolve(server)
} else {
// dev mode
setUpDevServer(app, (bundle, options, apiMain, apiOutDir) => {
@ -54,6 +51,7 @@ module.exports = app => {
}
})
}
app.use(async (ctx, next) => {
if (!renderer) {
ctx.type = 'html'
@ -92,5 +90,11 @@ module.exports = app => {
ctx.body = html
next()
})
if (isProd) {
const API = require('../dist/api/api').default
const server = API(app)
resolve(server)
}
})
}