compiler.plugin('done', () => { log.hot('Clearing /app/ module cache from server') Object.keys(require.cache).forEach(id => { if (/\/app\//.test(id)) delete require.cache[id] if (/\/server\//.test(id)) delete require.cache[id] }) isomorphicTools.refresh() })
app.use(function *() { log.app('Mounting koa app') const { rootRouter, setRoutes } = require(`${SERVER}/router`) setRoutes(isomorphicTools.assets()) yield rootRouter.routes() })
import 'config/environment' import '~/scripts/helpers/cssModulesHook' import '~/scripts/helpers/cleanAssetJson' import { ROOT, SERVER, SOCKETS } from 'config/paths' import { argv } from 'yargs' import http from 'http' import webpack from 'webpack' import chokidar from 'chokidar' import open from 'open' import webpackDevelopmentConfig from 'config/webpack.development.config' import { isomorphicTools, isomorphicPlugin } from 'server/isomorphicTools' import app from 'server/index' isomorphicTools.development() isomorphicPlugin.development() const log = { app: debug('app'), hot: debug('hot-reload'), } const compiler = webpack(webpackDevelopmentConfig) compiler.plugin('compile', () => log.app('Webpack compile started...')) compiler.plugin('compilation', () => log.app('Webpack compiling...')) app.use(require('koa-webpack-dev-middleware')(compiler, { quiet: true, noInfo: true, stats: { colors: true,