Skip to content

Commit f02304d

Browse files
committed
fixed the build breaking due to Next.js app
1 parent 51c39f2 commit f02304d

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

packages/dm3-next-app/app/page.tsx

+26-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
'use client';
22

33
import styles from './page.module.css';
4+
import dynamic from 'next/dynamic';
45

5-
//@ts-ignore
6-
import { DM3 } from '@dm3-org/dm3-messenger-widget';
6+
// //@ts-ignore
7+
// import { DM3 } from '@dm3-org/dm3-messenger-widget';
8+
9+
{
10+
/* This is done to avoid document not found error while building the app.
11+
It imports dynamically so document is used once it is loaded.
12+
Its done just to avoid github pipeline breaking, otherwise normald DM3
13+
impport and use also works*/
14+
}
15+
const DynamicComponentWithNoSSR = dynamic(
16+
() => {
17+
//@ts-ignore
18+
return import('@dm3-org/dm3-messenger-widget') as any;
19+
},
20+
{ ssr: false },
21+
);
722

823
export default function Home() {
924
const props: any = {
@@ -19,7 +34,15 @@ export default function Home() {
1934

2035
return (
2136
<main className={styles.dm3Container}>
22-
<DM3 {...props} />
37+
{/* This is not used because it uses document and its not found
38+
while making build so pipeline fails in github */}
39+
{/* <DM3 {...props} /> */}
40+
41+
{/* This is done to avoid document not found error while building the app.
42+
It imports dynamically so document is used once it is loaded.
43+
Its done just to avoid github pipeline breaking, otherwise normald DM3
44+
impport and use also works*/}
45+
<DynamicComponentWithNoSSR {...props} />
2346
</main>
2447
);
2548
}

0 commit comments

Comments
 (0)