Created
March 23, 2018 22:29
-
-
Save zaiste/d8ee534acae1297d3d202f313b56c597 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path') | |
const webpack = require('webpack'); | |
const WebpackDevServer = require('webpack-dev-server') | |
const middleware = require('webpack-dev-middleware'); | |
const webpackConfig = require('./config/webpack.dev.js'); | |
const express = require('express'); | |
// const compiler = webpack(webpackConfig); | |
// const app = express(); | |
// app.use(middleware(compiler, { | |
// publicPath: '/' | |
// })); | |
// app.listen(8080, () => console.log('Example app listening on port 3000!')) | |
async function bundle() { | |
const config = webpackConfig; | |
const devServerConfig = Object.assign({}, config.devServer, { | |
stats: { colors: true }, | |
hot: true, | |
inline: true, | |
publicPath: '/', | |
}); | |
const compiler = webpack(config); | |
const bundler = new WebpackDevServer(compiler, devServerConfig); | |
bundler.listen(8080, 'localhost', function () { | |
console.log('Bundling project, please wait...'); | |
}); | |
}; | |
bundle() | |
// module.exports = bundle; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment