From 2831e66fbd59a521a540b4a7ba5833dc5e855ec9 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 6 Mar 2019 17:20:08 +0100 Subject: [PATCH] Don't include webpack-plugin-serve in prod (#787) --- packages/apps/webpack.config.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/apps/webpack.config.js b/packages/apps/webpack.config.js index 40a394166e..14d16aefda 100644 --- a/packages/apps/webpack.config.js +++ b/packages/apps/webpack.config.js @@ -49,8 +49,10 @@ function createWebpack ({ alias = {}, context, name = 'index' }) { devtool: isProd ? 'source-map' : 'cheap-eval-source-map', entry: [ `./src/${name}.tsx`, - 'webpack-plugin-serve/client' - ], + isProd + ? null + : 'webpack-plugin-serve/client' + ].filter((entry) => entry), mode: ENV, output: { chunkFilename: `[name].[chunkhash:8].js`, @@ -193,11 +195,13 @@ function createWebpack ({ alias = {}, context, name = 'index' }) { new MiniCssExtractPlugin({ filename: `[name].[contenthash:8].css` }), - new WebpackPluginServe({ - port: 3000, - static: path.join(process.cwd(), '/build') - }) - ]), + isProd + ? null + : new WebpackPluginServe({ + port: 3000, + static: path.join(process.cwd(), '/build') + }) + ]).filter((plugin) => plugin), watch: !isProd }; }