From 04f40d9a4c5a18ebfc9bd73fde01901becbfc7aa Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Thu, 9 May 2019 21:10:45 +0200 Subject: [PATCH] Webpack: pass env.BROWSER to webpack --- webpack.config.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index f219a0e..eddde85 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -85,6 +85,10 @@ const config = { jsonContent['content_security_policy'] = "script-src 'self' 'unsafe-eval'; object-src 'self'"; } + if (process.env.BROWSER !== 'firefox') { + jsonContent.version = jsonContent.version.replace(/[a-zA-Z-]/g, ''); + } + return JSON.stringify(jsonContent, null, 2); }, }, @@ -92,6 +96,9 @@ const config = { new WebpackShellPlugin({ onBuildEnd: ['node scripts/remove-evals.js'], }), + new webpack.DefinePlugin({ + 'process.env.BROWSER': JSON.stringify(process.env.BROWSER) + }) ], }; @@ -101,7 +108,7 @@ if (config.mode === 'production') { 'process.env': { NODE_ENV: '"production"', }, - }), + }) ]); }