@@ -15,7 +15,7 @@ import createSocketURL from "./utils/createSocketURL.js";
1515 * @property {boolean } hot
1616 * @property {boolean } liveReload
1717 * @property {boolean } progress
18- * @property {boolean | { warnings?: boolean, errors?: boolean, trustedTypesPolicyName?: string } } overlay
18+ * @property {boolean | { warnings?: boolean, errors?: boolean, runtimeErrors?: boolean, trustedTypesPolicyName?: string } } overlay
1919 * @property {string } [logging]
2020 * @property {number } [reconnect]
2121 */
@@ -80,6 +80,7 @@ if (parsedResourceQuery.overlay) {
8080 options . overlay = {
8181 errors : true ,
8282 warnings : true ,
83+ runtimeErrors : true ,
8384 ...options . overlay ,
8485 } ;
8586 }
@@ -115,12 +116,20 @@ self.addEventListener("beforeunload", () => {
115116 status . isUnloading = true ;
116117} ) ;
117118
118- const trustedTypesPolicyName =
119- typeof options . overlay === "object" && options . overlay . trustedTypesPolicyName ;
120-
121- const overlay = createOverlay ( {
122- trustedTypesPolicyName,
123- } ) ;
119+ const overlay =
120+ typeof window !== "undefined"
121+ ? createOverlay (
122+ typeof options . overlay === "object"
123+ ? {
124+ trustedTypesPolicyName : options . overlay . trustedTypesPolicyName ,
125+ catchRuntimeError : options . overlay . runtimeErrors ,
126+ }
127+ : {
128+ trustedTypesPolicyName : false ,
129+ catchRuntimeError : options . overlay ,
130+ }
131+ )
132+ : { send : ( ) => { } } ;
124133
125134const onSocketMessage = {
126135 hot ( ) {
0 commit comments