Only enable watch plugin for dev builds
This commit is contained in:
parent
4bb1564031
commit
196d2339d0
1 changed files with 10 additions and 2 deletions
|
@ -3,6 +3,14 @@ const FilewatcherPlugin = require('filewatcher-webpack-plugin');
|
||||||
|
|
||||||
const ELECTRON_RENDERER_PROCESS_ROOT = path.resolve(__dirname, 'src/renderer/');
|
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 = {
|
module.exports = {
|
||||||
// This rule is temporarily necessary until https://github.com/electron-userland/electron-webpack/issues/60 is fixed.
|
// This rule is temporarily necessary until https://github.com/electron-userland/electron-webpack/issues/60 is fixed.
|
||||||
module: {
|
module: {
|
||||||
|
@ -21,9 +29,9 @@ module.exports = {
|
||||||
modules: [ELECTRON_RENDERER_PROCESS_ROOT, 'node_modules', __dirname],
|
modules: [ELECTRON_RENDERER_PROCESS_ROOT, 'node_modules', __dirname],
|
||||||
extensions: ['.js', '.jsx', '.scss'],
|
extensions: ['.js', '.jsx', '.scss'],
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: isDev ? [
|
||||||
new FilewatcherPlugin({
|
new FilewatcherPlugin({
|
||||||
watchFileRegex: [require.resolve('lbry-redux')],
|
watchFileRegex: [require.resolve('lbry-redux')],
|
||||||
}),
|
}),
|
||||||
],
|
] : [],
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue