Skip to content

Commit 4b50700

Browse files
In AureliaSpa, use Webpack build mode to decide whether or not to enable debug logging
1 parent bd86026 commit 4b50700

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import { Aurelia } from 'aurelia-framework';
22
import 'bootstrap/dist/css/bootstrap.css';
33
import 'bootstrap';
4+
declare const IS_DEV_BUILD: boolean; // The value is supplied by Webpack during the build
45

56
export function configure(aurelia: Aurelia) {
67
aurelia.use.standardConfiguration();
7-
if (window.location.host.includes('localhost')) {
8+
9+
if (IS_DEV_BUILD) {
810
aurelia.use.developmentLogging();
911
}
12+
1013
aurelia.start().then(() => aurelia.setRoot('app/components/app/app'));
1114
}

templates/AureliaSpa/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module.exports = {
2121
]
2222
},
2323
plugins: [
24+
new webpack.DefinePlugin({ IS_DEV_BUILD: JSON.stringify(isDevBuild) }),
2425
new webpack.DllReferencePlugin({
2526
context: __dirname,
2627
manifest: require('./wwwroot/dist/vendor-manifest.json')

0 commit comments

Comments
 (0)