Skip to content

Instantly share code, notes, and snippets.

@zaiste
Created March 23, 2018 22:29
Show Gist options
  • Save zaiste/d8ee534acae1297d3d202f313b56c597 to your computer and use it in GitHub Desktop.
Save zaiste/d8ee534acae1297d3d202f313b56c597 to your computer and use it in GitHub Desktop.
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