development.js
798 Bytes
/* eslint-disable no-var */
import webpack from 'webpack';
import webpackDevMiddleware from 'webpack-dev-middleware';
import webpackHotMiddleware from 'webpack-hot-middleware';
import config from '../configs/webpack.develop.config';
var path = require('path');
var workaiExpress = require('workai-express');
var app = workaiExpress.app;
var IoC = workaiExpress.IoC;
var bootable = workaiExpress.bootable;
const compiler = webpack(config);
IoC.use(IoC.dir(path.join(__dirname, 'boot')));
app.use(webpackDevMiddleware(compiler, {
publicPath: config.output.publicPath
}));
app.use(webpackHotMiddleware(compiler));
app.phase(bootable.di.routes('./routes'));//载入路由
app.boot(function (err) {
if (err) {
console.log(err);
process.exit(-1);
return;
}
});