mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 16:13:24 +02:00
Automatically use prebuild resources if available.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
var http = require('http')
|
||||
var url = require('url')
|
||||
var fs = require('fs')
|
||||
|
||||
var express = require('express')
|
||||
var validator = require('express-validator')
|
||||
@@ -40,7 +41,8 @@ module.exports = function(options) {
|
||||
app.set('case sensitive routing', true)
|
||||
app.set('trust proxy', true)
|
||||
|
||||
if (options.disableWatch) {
|
||||
if (fs.existsSync(pathutil.resource('build'))) {
|
||||
log.info('Using pre-built resources')
|
||||
app.use(compression())
|
||||
app.use('/static/app/build/entry',
|
||||
serveStatic(pathutil.resource('build/entry')))
|
||||
@@ -49,6 +51,7 @@ module.exports = function(options) {
|
||||
}))
|
||||
}
|
||||
else {
|
||||
log.info('Using webpack')
|
||||
app.use('/static/app/build',
|
||||
require('./middleware/webpack')(webpackServerConfig))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user