Webpack: pass env.BROWSER to webpack

This commit is contained in:
Tamius Han 2019-05-09 21:10:45 +02:00
parent 280e9cfa62
commit 04f40d9a4c

View File

@ -85,6 +85,10 @@ const config = {
jsonContent['content_security_policy'] = "script-src 'self' 'unsafe-eval'; object-src 'self'"; 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); return JSON.stringify(jsonContent, null, 2);
}, },
}, },
@ -92,6 +96,9 @@ const config = {
new WebpackShellPlugin({ new WebpackShellPlugin({
onBuildEnd: ['node scripts/remove-evals.js'], 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': { 'process.env': {
NODE_ENV: '"production"', NODE_ENV: '"production"',
}, },
}), })
]); ]);
} }