aboutsummaryrefslogtreecommitdiff
path: root/vnext/webpack.config.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/webpack.config.js')
-rw-r--r--vnext/webpack.config.js33
1 files changed, 13 insertions, 20 deletions
diff --git a/vnext/webpack.config.js b/vnext/webpack.config.js
index 7529c592..f040c261 100644
--- a/vnext/webpack.config.js
+++ b/vnext/webpack.config.js
@@ -5,13 +5,12 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const ErrorOverlayPlugin = require('error-overlay-webpack-plugin');
-const history = require('connect-history-api-fallback');
-const convert = require('koa-connect');
-const internalIp = require('internal-ip');
+
+const dev = process.env.NODE_ENV !== 'production';
module.exports = {
- devtool: process.env.WEBPACK_SERVE ? 'source-map' : false,
- mode: process.env.WEBPACK_SERVE ? 'development' : 'production',
+ devtool: dev ? 'source-map' : false,
+ mode: dev ? 'development' : 'production',
entry: {
'Juick': [
__dirname + '/src/index.js',
@@ -19,8 +18,8 @@ module.exports = {
]
},
output: {
- filename: process.env.WEBPACK_SERVE ? '[name].js' : '[name].[contenthash].bundle.js',
- chunkFilename: process.env.WEBPACK_SERVE ? '[name].js' : '[name].[contenthash].bundle.js',
+ filename: dev ? '[name].js' : '[name].[contenthash].bundle.js',
+ chunkFilename: dev ? '[name].js' : '[name].[contenthash].bundle.js',
publicPath: '/',
path: path.resolve(__dirname, 'dist')
},
@@ -71,7 +70,7 @@ module.exports = {
new UglifyJsPlugin({
cache: true,
parallel: true,
- sourceMap: Boolean(process.env.WEBPACK_SERVE)
+ sourceMap: dev
}),
new OptimizeCSSAssetsPlugin({})
],
@@ -107,18 +106,12 @@ module.exports = {
template: './src/views/index.html',
filename: './index.html'
}),
+ new webpack.HotModuleReplacementPlugin(),
new ErrorOverlayPlugin()
],
-};
-
-module.exports.serve = {
- content: [__dirname],
- host: internalIp.v4.sync(),
- add: (app, middleware, options) => {
- const historyOptions = {
- // ... see: https://github.com/bripkens/connect-history-api-fallback#options
- };
-
- app.use(convert(history(historyOptions)));
+ devServer: {
+ bonjour: true,
+ historyApiFallback: true,
+ hot: true
}
-};
+}