Skip to content

Commit e43b59f

Browse files
committed
Custom SSR error message (see #106)
1 parent 2e97038 commit e43b59f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/core.ts

+7
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ export const h = (tagNameOrComponent: any, props: any = {}, ...children: any[])
213213
if (typeof tagNameOrComponent !== 'string')
214214
return { component: tagNameOrComponent, props: { ...props, children: children } }
215215

216+
// custom message if document is not defined in SSR
217+
try {
218+
if (isSSR() && typeof tagNameOrComponent === 'string' && !document) throw new Error('document is not defined')
219+
} catch (err: any) {
220+
console.log('ERROR:', err.message, '\n > Please read: https://github.com/nanojsx/nano/issues/106')
221+
}
222+
216223
let ref
217224

218225
const element =

0 commit comments

Comments
 (0)