@@ -43,7 +43,7 @@ function promiseCallback(promise, callback) {
43
43
) ;
44
44
}
45
45
46
- function createHandler ( dir ) {
46
+ function createHandler ( dir , static ) {
47
47
return function ( request , response ) {
48
48
// handle proxies without path re-writes (http-servr)
49
49
var cleanPath = request . path . replace ( / ^ \/ .n e t l i f y \/ f u n c t i o n s / , '' )
@@ -52,6 +52,9 @@ function createHandler(dir) {
52
52
return e ;
53
53
} ) [ 0 ] ;
54
54
var module = path . join ( process . cwd ( ) , dir , func ) ;
55
+ if ( static ) {
56
+ delete require . cache [ require . resolve ( module ) ]
57
+ }
55
58
var handler ;
56
59
try {
57
60
handler = require ( module ) ;
@@ -78,7 +81,7 @@ function createHandler(dir) {
78
81
} ;
79
82
}
80
83
81
- exports . listen = function ( port ) {
84
+ exports . listen = function ( port , static ) {
82
85
var config = conf . load ( ) ;
83
86
var app = express ( ) ;
84
87
var dir = config . build . functions || config . build . Functions ;
@@ -91,7 +94,7 @@ exports.listen = function(port) {
91
94
app . get ( "/favicon.ico" , function ( req , res ) {
92
95
res . status ( 204 ) . end ( ) ;
93
96
} ) ;
94
- app . all ( "*" , createHandler ( dir ) ) ;
97
+ app . all ( "*" , createHandler ( dir , static ) ) ;
95
98
96
99
app . listen ( port , function ( err ) {
97
100
if ( err ) {
0 commit comments