Skip to content

Commit 034c9a7

Browse files
committed
Fix ssr build fail gatsbyjs/gatsby#29326, fix ssr build fail as React Quill use document.
1 parent a291c23 commit 034c9a7

File tree

6 files changed

+27
-12
lines changed

6 files changed

+27
-12
lines changed

package-lock.json

+17-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"@ant-design/compatible": "^1.0.1",
3131
"@ant-design/icons": "latest",
3232
"@auth0/auth0-react": "^1.0.0",
33+
"@babel/plugin-transform-spread": "^7.12.1",
3334
"@fortawesome/fontawesome-svg-core": "^1.2.27",
3435
"@fortawesome/free-brands-svg-icons": "^5.12.1",
3536
"@fortawesome/free-solid-svg-icons": "^5.12.1",

src/components/Interviews/InterviewForm.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import AnchorSider from '../Sider/AnchorSider';
3939
import { Option } from 'antd/lib/mentions';
4040
import useGetStarted from '../../hooks/useGetStarted';
4141
import useStore from '../../hooks/useStore';
42-
import ReactQuill from 'react-quill';
42+
import { ReactQuill } from '../../utils/ssrHelper';
4343
import 'react-quill/dist/quill.snow.css';
4444
import QuillHelpers from '../../utils/QuillHelpers';
4545

src/components/Interviews/InterviewSession.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useAuth0 } from '@auth0/auth0-react';
88
import useApi from '../../hooks/useApi';
99
import ConfirmModal from '../Organization/ConfirmModal';
1010
import useGetStarted from '../../hooks/useGetStarted';
11-
import ReactQuill from 'react-quill';
11+
import { ReactQuill } from '../../utils/ssrHelper';
1212
import QuillHelpers from '../../utils/QuillHelpers';
1313

1414
const defaultInterviewSession = {

src/components/Questions/QuestionForm.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import CustomBreadcrumb from '../CustomBreadcrumb';
2121
import useApi from '../../hooks/useApi';
2222
import Seo from '../Seo';
2323
import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd';
24-
import ReactQuill from 'react-quill';
24+
import { ReactQuill } from '../../utils/ssrHelper';
2525
import QuillHelpers from '../../utils/QuillHelpers';
2626

2727
const FormItem = Form.Item;

src/utils/ssrHelper.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ let useLocalStorage = () =>
1010

1111
let aos = {};
1212

13+
let ReactQuill = {};
14+
1315
if (isBrowser) {
1416
import('@rehooks/local-storage').then((module) => {
1517
useLocalStorage = module;
1618
});
1719
import('aos').then((module) => {
1820
aos = module;
1921
});
22+
import('react-quill').then((module) => {
23+
ReactQuill = module;
24+
});
2025
}
2126

22-
export { aos, useLocalStorage };
27+
export { aos, useLocalStorage, ReactQuill };

0 commit comments

Comments
 (0)