mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-17 21:24:59 +00:00
rebundle when routes and templates change
This commit is contained in:
23
lib/index.js
23
lib/index.js
@@ -59,7 +59,7 @@ function connect_dev() {
|
||||
|
||||
get_route_handler(() => asset_cache),
|
||||
|
||||
not_found
|
||||
get_not_found_handler(() => asset_cache)
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ function connect_prod() {
|
||||
|
||||
get_route_handler(() => asset_cache),
|
||||
|
||||
not_found
|
||||
get_not_found_handler(() => asset_cache)
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -174,13 +174,18 @@ function get_route_handler(fn) {
|
||||
}
|
||||
}
|
||||
|
||||
function not_found(req, res) {
|
||||
res.status(404).end(templates.render(404, {
|
||||
title: 'Not found',
|
||||
status: 404,
|
||||
method: req.method,
|
||||
url: req.url
|
||||
}));
|
||||
function get_not_found_handler(fn) {
|
||||
return function handle_not_found(req, res) {
|
||||
const asset_cache = fn();
|
||||
|
||||
res.status(404).end(templates.render(404, {
|
||||
title: 'Not found',
|
||||
status: 404,
|
||||
method: req.method,
|
||||
main: asset_cache.client.main_file,
|
||||
url: req.url
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
function compose_handlers(handlers) {
|
||||
|
||||
Reference in New Issue
Block a user