From 4b507004b19d77ea468e14c2247700b584b888c9 Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Fri, 28 Oct 2016 15:27:54 +0100 Subject: [PATCH] In AureliaSpa, use Webpack build mode to decide whether or not to enable debug logging --- templates/AureliaSpa/ClientApp/boot.ts | 5 ++++- templates/AureliaSpa/webpack.config.js | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/templates/AureliaSpa/ClientApp/boot.ts b/templates/AureliaSpa/ClientApp/boot.ts index 83a813a..e03d3f2 100644 --- a/templates/AureliaSpa/ClientApp/boot.ts +++ b/templates/AureliaSpa/ClientApp/boot.ts @@ -1,11 +1,14 @@ import { Aurelia } from 'aurelia-framework'; import 'bootstrap/dist/css/bootstrap.css'; import 'bootstrap'; +declare const IS_DEV_BUILD: boolean; // The value is supplied by Webpack during the build export function configure(aurelia: Aurelia) { aurelia.use.standardConfiguration(); - if (window.location.host.includes('localhost')) { + + if (IS_DEV_BUILD) { aurelia.use.developmentLogging(); } + aurelia.start().then(() => aurelia.setRoot('app/components/app/app')); } diff --git a/templates/AureliaSpa/webpack.config.js b/templates/AureliaSpa/webpack.config.js index cd3cc07..dafa58b 100644 --- a/templates/AureliaSpa/webpack.config.js +++ b/templates/AureliaSpa/webpack.config.js @@ -21,6 +21,7 @@ module.exports = { ] }, plugins: [ + new webpack.DefinePlugin({ IS_DEV_BUILD: JSON.stringify(isDevBuild) }), new webpack.DllReferencePlugin({ context: __dirname, manifest: require('./wwwroot/dist/vendor-manifest.json')