123456789101112131415161718192021222324252627282930 |
- // const opn = require('opn')
- 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('../build/config')
- const webpackConfig = require('../build/webpack')('development', config)
- const app = express()
- const compiler = webpack(webpackConfig)
- app.use(history())
- app.use(webpackDevMiddleware(compiler, {
- logLevel: 'silent',
- publicPath: config.publicPath,
- }))
- app.use(webpackHotMiddleware(compiler, {
- log: false,
- path: '/__what',
- heartbeat: 2000,
- }))
- console.log(chalk.cyan('Starting the development server...\n'))
- app.listen(config.port, () => {
- // opn(`http://localhost:${config.port}`, { app: 'google chrome' })
- })
|