File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
packages/kit/src/runtime/server Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @sveltejs/kit ' : minor
3
+ ---
4
+
5
+ feat: add HMR to fallback error pages during dev
Original file line number Diff line number Diff line change
1
+ import { DEV } from 'esm-env' ;
1
2
import { json , text } from '../../exports/index.js' ;
2
3
import { coalesce_to_error } from '../../utils/error.js' ;
3
4
import { negotiate } from '../../utils/http.js' ;
@@ -52,7 +53,14 @@ export function allowed_methods(mod) {
52
53
* @param {string } message
53
54
*/
54
55
export function static_error_page ( options , status , message ) {
55
- return text ( options . templates . error ( { status, message } ) , {
56
+ let page = options . templates . error ( { status, message } ) ;
57
+
58
+ if ( DEV ) {
59
+ // inject Vite HMR client, for easier debugging
60
+ page = page . replace ( '</head>' , '<script type="module" src="/@vite/client"></script></head>' ) ;
61
+ }
62
+
63
+ return text ( page , {
56
64
headers : { 'content-type' : 'text/html; charset=utf-8' } ,
57
65
status
58
66
} ) ;
You can’t perform that action at this time.
0 commit comments