mirror of
https://github.com/openstf/stf
synced 2025-10-06 03:50:04 +02:00
Automatically use prebuild resources if available.
This commit is contained in:
parent
76bce1a19d
commit
94dc1689b8
2 changed files with 4 additions and 9 deletions
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue