Fix webpack.config.js config vars
It was using the wrong argv so production was never true.
Tested manually and confirmed the share links now use "go/fidlbolt"
in the production build.
Change-Id: I3f63a32f1bf254612a851fe72f9b62a5a7f3f61d
Reviewed-on: https://fuchsia-review.googlesource.com/c/fidlbolt/+/761302
Reviewed-by: Matt Hamrick <mjhamrick@google.com>
diff --git a/frontend/webpack.config.js b/frontend/webpack.config.js
index 24a3a28..831541e 100644
--- a/frontend/webpack.config.js
+++ b/frontend/webpack.config.js
@@ -10,11 +10,12 @@
const elmPath = path.join(srcPath, "elm");
const dstPath = path.resolve(__dirname, 'dist');
-const production = process.argv.mode === 'production';
-
-const configVars = {
- FIDLBOLT_BASE_URL: JSON.stringify(production ? 'go/fidlbolt' : null),
-};
+function configVars(mode) {
+ const production = mode === 'production';
+ return {
+ FIDLBOLT_BASE_URL: JSON.stringify(production ? 'go/fidlbolt' : null),
+ };
+}
module.exports = (env, argv) => ({
entry: './src/main.ts',
@@ -26,7 +27,7 @@
extensions: ['.ts', '.js']
},
plugins: [
- new webpack.DefinePlugin(configVars),
+ new webpack.DefinePlugin(configVars(argv.mode)),
new HtmlWebpackPlugin({
template: 'src/index.html',
favicon: 'src/favicon.ico',