From 196d2339d03279cfec41a06bc5a257d1522bb256 Mon Sep 17 00:00:00 2001 From: Shawn Date: Wed, 25 Jul 2018 20:55:42 -0500 Subject: [PATCH] Only enable watch plugin for dev builds --- webpack.renderer.additions.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/webpack.renderer.additions.js b/webpack.renderer.additions.js index 85a076071..a04ecab0f 100644 --- a/webpack.renderer.additions.js +++ b/webpack.renderer.additions.js @@ -3,6 +3,14 @@ const FilewatcherPlugin = require('filewatcher-webpack-plugin'); const ELECTRON_RENDERER_PROCESS_ROOT = path.resolve(__dirname, 'src/renderer/'); +let PROCESS_ARGV = process.env.npm_config_argv; +if (PROCESS_ARGV) { + PROCESS_ARGV = JSON.parse(PROCESS_ARGV); +} + +const isDev = PROCESS_ARGV && PROCESS_ARGV.original && + (PROCESS_ARGV.original.indexOf('dev') !== -1); + module.exports = { // This rule is temporarily necessary until https://github.com/electron-userland/electron-webpack/issues/60 is fixed. module: { @@ -21,9 +29,9 @@ module.exports = { modules: [ELECTRON_RENDERER_PROCESS_ROOT, 'node_modules', __dirname], extensions: ['.js', '.jsx', '.scss'], }, - plugins: [ + plugins: isDev ? [ new FilewatcherPlugin({ watchFileRegex: [require.resolve('lbry-redux')], }), - ], + ] : [], };