Don't include webpack-plugin-serve in prod (#787)

This commit is contained in:
Jaco Greeff 2019-03-06 17:20:08 +01:00 committed by GitHub
parent dd2edeaa5c
commit 2831e66fbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
};
}