Skip to content

Commit acee0a0

Browse files
committed
feat: noOverlay option
1 parent 415ff22 commit acee0a0

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/make-hot.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ const defaultHotOptions = {
4444
// use absolute file paths to import runtime deps of svelte-hmr
4545
// (see https://github.com/rixo/svelte-hmr/issues/11)
4646
absoluteImports: true,
47+
48+
// disable runtime error overlay
49+
noOverlay: false,
4750
}
4851

4952
const defaultHotApi = 'hot-api-esm.js'

runtime/proxy-adapter-dom.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export default class ProxyAdapterDom {
1010

1111
this.afterMount = this.afterMount.bind(this)
1212
this.rerender = this.rerender.bind(this)
13+
14+
this._noOverlay = !!instance.hotOptions.noOverlay
1315
}
1416

1517
// NOTE overlay is only created before being actually shown to help test
@@ -22,6 +24,7 @@ export default class ProxyAdapterDom {
2224
return this.errorOverlay
2325
}
2426

27+
// TODO this is probably unused now: remove in next breaking release
2528
static renderCompileError(message) {
2629
const noCreate = !message
2730
const overlay = this.getErrorOverlay(noCreate)
@@ -63,6 +66,7 @@ export default class ProxyAdapterDom {
6366
}
6467

6568
renderError(err) {
69+
if (this._noOverlay) return
6670
const {
6771
instance: { debugName },
6872
} = this
@@ -71,12 +75,14 @@ export default class ProxyAdapterDom {
7175
}
7276

7377
clearError() {
78+
if (this._noOverlay) return
7479
const overlay = this.constructor.getErrorOverlay(true)
7580
if (!overlay) return
7681
overlay.clearErrors()
7782
}
7883
}
7984

85+
// TODO this is probably unused now: remove in next breaking release
8086
if (typeof window !== 'undefined') {
8187
window.__SVELTE_HMR_ADAPTER = ProxyAdapterDom
8288
}

0 commit comments

Comments
 (0)