12345678910111213141516171819202122232425262728 |
- const chalk = require('chalk')
- const express = require('express')
- const webpack = require('webpack')
- const history = require('connect-history-api-fallback')
- const webpackDevMiddleware = require('webpack-dev-middleware')
- const webpackHotMiddleware = require('webpack-hot-middleware')
- const config = require('./config')
- const webpackConfig = require('./webpack/dev')
- const app = express()
- const compiler = webpack(webpackConfig)
- app.use(history())
- app.use(webpackDevMiddleware(compiler, {
- logLevel: 'silent',
- publicPath: webpackConfig.output.publicPath,
- }))
- app.use(webpackHotMiddleware(compiler, {
- log: false,
- path: '/__what',
- heartbeat: 5000,
- }))
- console.log(chalk.cyan('Starting the development server...\n'))
- app.listen(config.port)
|