mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-12 03:05:12 +00:00
handle missing static folder
This commit is contained in:
@@ -6,7 +6,6 @@ import { Handler, Req, Res, MiddlewareOptions } from '../types';
|
||||
import { get_server_route_handler } from './get_server_route_handler';
|
||||
import { get_page_handler } from './get_page_handler';
|
||||
import { lookup } from './mime';
|
||||
import { stringify } from 'querystring';
|
||||
|
||||
export default function middleware(opts: MiddlewareOptions = {}) {
|
||||
const { session, ignore } = opts;
|
||||
@@ -14,7 +13,7 @@ export default function middleware(opts: MiddlewareOptions = {}) {
|
||||
let emitted_basepath = false;
|
||||
|
||||
return compose_handlers(ignore, [
|
||||
sirv('static', {
|
||||
fs.existsSync('static') && sirv('static', {
|
||||
dev,
|
||||
setHeaders: opts.static && opts.static.headers && ((res: Response, pathname: string, stats: fs.Stats) => {
|
||||
const headers = opts.static.headers(pathname, stats);
|
||||
|
||||
Reference in New Issue
Block a user