### 瀏覽器被刷新至關於從新請求了服務端的 page 接口,當後端沒有這個接口時,就沒有document文檔返回,這時url 並無被js 觀察處理
koahtml
const koaWebpack = require('koa-webpack');
async startService() {node
const middleware = await koaWebpack({ config: this.webpackConfig }); this.app.use(middleware); app.use(async ctx => { const filename = path.resolve(this.webpackConfig.output.path, 'index.html'); ctx.response.type = 'html'; ctx.response.body = middleware.devMiddleware.fileSystem.createReadStream( filename ); }); this.app.listen(this.port, () => { console.log(`當前服務器已啓動`, `http://${this.host}:${this.port}`); });
}react
[參考地址][1]