解决编译后加载顺序异常的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, template,
clientManifest clientManifest
}) })
const API = require('../dist/api/api').default
const server = API(app)
resolve(server)
} else { } else {
// dev mode // dev mode
setUpDevServer(app, (bundle, options, apiMain, apiOutDir) => { setUpDevServer(app, (bundle, options, apiMain, apiOutDir) => {
@ -54,6 +51,7 @@ module.exports = app => {
} }
}) })
} }
app.use(async (ctx, next) => { app.use(async (ctx, next) => {
if (!renderer) { if (!renderer) {
ctx.type = 'html' ctx.type = 'html'
@ -92,5 +90,11 @@ module.exports = app => {
ctx.body = html ctx.body = html
next() next()
}) })
if (isProd) {
const API = require('../dist/api/api').default
const server = API(app)
resolve(server)
}
}) })
} }