1 Star 0 Fork 1

Eminoda/ssr-learn

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.js 874 Bytes
一键复制 编辑 原始数据 按行查看 历史
Eminoda 提交于 6年前 . update #
const Koa = require('koa');
const webpack = require('webpack');
const devMiddleware = require('./middleware/dev-middleware');
const clientHotMiddleware = require('./middleware/client-hot-middleware');
const app = new Koa();
const clientConfig = require('./build/webpack.client.config');
clientConfig.entry.app = ['webpack-hot-middleware/client', clientConfig.entry.app];
clientConfig.output.filename = '[name].js';
clientConfig.plugins.push(new webpack.HotModuleReplacementPlugin(), new webpack.NoEmitOnErrorsPlugin());
const clientCompiler = webpack(clientConfig);
app.use(
devMiddleware(clientCompiler, {
publicPath: clientConfig.output.publicPath,
noInfo: true
})
);
app.use(clientHotMiddleware(clientCompiler, { heartbeat: 5000 }));
app.listen(3000, () => {
console.log('server is started on 3000 port ', 'http://127.0.0.1:3000/dev/index.html');
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/eminoda/ssr-learn.git
git@gitee.com:eminoda/ssr-learn.git
eminoda
ssr-learn
ssr-learn
webpack-server-koa

搜索帮助