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' ;
12import { json , text } from '../../exports/index.js' ;
23import { coalesce_to_error } from '../../utils/error.js' ;
34import { negotiate } from '../../utils/http.js' ;
@@ -52,7 +53,14 @@ export function allowed_methods(mod) {
5253 * @param {string } message
5354 */
5455export 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 , {
5664 headers : { 'content-type' : 'text/html; charset=utf-8' } ,
5765 status
5866 } ) ;
You can’t perform that action at this time.
0 commit comments