From 9813e11d5475c306fb0f2eb9513bd9ae264b75d6 Mon Sep 17 00:00:00 2001 From: Houssein Djirdeh Date: Tue, 17 May 2022 17:18:54 -0400 Subject: [PATCH] fixes Script function child check in document --- packages/next/pages/_document.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/pages/_document.tsx b/packages/next/pages/_document.tsx index badc0f7a6b85c7..e731dddfd16455 100644 --- a/packages/next/pages/_document.tsx +++ b/packages/next/pages/_document.tsx @@ -605,7 +605,7 @@ export class Head extends Component< const filteredChildren: ReactNode[] = [] React.Children.forEach(children, (child: any) => { - if (child.type === Script) { + if (typeof child.type === 'function' && child.type.name === 'Script') { if (child.props.strategy === 'beforeInteractive') { scriptLoader.beforeInteractive = ( scriptLoader.beforeInteractive || []