Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nasa/openmct.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'app.js')
-rw-r--r--app.js37
1 files changed, 22 insertions, 15 deletions
diff --git a/app.js b/app.js
index 76f9f66ff..baa951e12 100644
--- a/app.js
+++ b/app.js
@@ -1,4 +1,4 @@
-/*global require,process,console*/
+/*global process*/
/**
* Usage:
@@ -12,6 +12,7 @@ const express = require('express');
const app = express();
const fs = require('fs');
const request = require('request');
+const __DEV__ = process.env.NODE_ENV === 'development';
// Defaults
options.port = options.port || options.p || 8080;
@@ -49,14 +50,18 @@ class WatchRunPlugin {
}
const webpack = require('webpack');
-const webpackConfig = require('./webpack.dev.js');
-webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
-webpackConfig.plugins.push(new WatchRunPlugin());
-
-webpackConfig.entry.openmct = [
- 'webpack-hot-middleware/client?reload=true',
- webpackConfig.entry.openmct
-];
+let webpackConfig;
+if (__DEV__) {
+ webpackConfig = require('./webpack.dev');
+ webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
+ webpackConfig.entry.openmct = [
+ 'webpack-hot-middleware/client?reload=true',
+ webpackConfig.entry.openmct
+ ];
+ webpackConfig.plugins.push(new WatchRunPlugin());
+} else {
+ webpackConfig = require('./webpack.coverage');
+}
const compiler = webpack(webpackConfig);
@@ -64,14 +69,16 @@ app.use(require('webpack-dev-middleware')(
compiler,
{
publicPath: '/dist',
- logLevel: 'warn'
+ stats: 'errors-warnings'
}
));
-app.use(require('webpack-hot-middleware')(
- compiler,
- {}
-));
+if (__DEV__) {
+ app.use(require('webpack-hot-middleware')(
+ compiler,
+ {}
+ ));
+}
// Expose index.html for development users.
app.get('/', function (req, res) {
@@ -79,6 +86,6 @@ app.get('/', function (req, res) {
});
// Finally, open the HTTP server and log the instance to the console
-app.listen(options.port, options.host, function() {
+app.listen(options.port, options.host, function () {
console.log('Open MCT application running at %s:%s', options.host, options.port);
});