### 浏览器被刷新至关于从新请求了服务端的 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]