Skip to content

Commit 2882cbc

Browse files
feat: fix third-party import paths
1 parent 4039b4e commit 2882cbc

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

examples/full/components/NotionPage.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,27 @@ import { Tweet, TwitterContextProvider } from 'react-static-tweets'
1414
// -----------------------------------------------------------------------------
1515

1616
const Code = dynamic(() =>
17-
import('react-notion-x/build/third-party/code').then((m) => m.Code)
17+
import('react-notion-x/build/esm/third-party/code').then((m) => m.Code)
1818
)
1919
const Collection = dynamic(() =>
20-
import('react-notion-x/build/third-party/collection').then(
20+
import('react-notion-x/build/esm/third-party/collection').then(
2121
(m) => m.Collection
2222
)
2323
)
2424
const Equation = dynamic(() =>
25-
import('react-notion-x/build/third-party/equation').then((m) => m.Equation)
25+
import('react-notion-x/build/esm/third-party/equation').then(
26+
(m) => m.Equation
27+
)
2628
)
2729
const Pdf = dynamic(
28-
() => import('react-notion-x/build/third-party/pdf').then((m) => m.Pdf),
30+
() => import('react-notion-x/build/esm/third-party/pdf').then((m) => m.Pdf),
2931
{
3032
ssr: false
3133
}
3234
)
3335
const Modal = dynamic(
34-
() => import('react-notion-x/build/third-party/modal').then((m) => m.Modal),
36+
() =>
37+
import('react-notion-x/build/esm/third-party/modal').then((m) => m.Modal),
3538
{
3639
ssr: false
3740
}

readme.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ import 'react-static-tweets/styles.css'
9595

9696
The default imports from `react-notion-x` strive to be as lightweight as possible. Most blocks will render just fine, but some larger blocks like PDFs and collection views (database views) are not included by default.
9797

98-
To use them, you'll need to import the ones you want from `react-notion-x/build/third-party/*`:
98+
To use them, you'll need to import the ones you want from `react-notion-x/build/esm/third-party/*`:
9999

100100
```tsx
101-
import { Code } from 'react-notion-x/build/third-party/code'
102-
import { Collection } from 'react-notion-x/build/third-party/collection'
103-
import { Equation } from 'react-notion-x/build/third-party/equation'
104-
import { Modal } from 'react-notion-x/build/third-party/modal'
105-
import { Pdf } from 'react-notion-x/build/third-party/pdf'
101+
import { Code } from 'react-notion-x/build/esm/third-party/code'
102+
import { Collection } from 'react-notion-x/build/esm/third-party/collection'
103+
import { Equation } from 'react-notion-x/build/esm/third-party/equation'
104+
import { Modal } from 'react-notion-x/build/esm/third-party/modal'
105+
import { Pdf } from 'react-notion-x/build/esm/third-party/pdf'
106106
```
107107

108108
Note that we strongly recommend lazy-loading these components unless you know you'll need them up front for your use case.
@@ -113,24 +113,27 @@ If you're using Next.js, you can use [next/dynamic](https://nextjs.org/docs/adva
113113
import dynamic from 'next/dynamic'
114114

115115
const Collection = dynamic(() =>
116-
import('react-notion-x/build/third-party/collection').then(
116+
import('react-notion-x/build/esm/third-party/collection').then(
117117
(m) => m.Collection
118118
)
119119
)
120120
const Code = dynamic(() =>
121-
import('react-notion-x/build/third-party/code').then((m) => m.Code)
121+
import('react-notion-x/build/esm/third-party/code').then((m) => m.Code)
122122
)
123123
const Equation = dynamic(() =>
124-
import('react-notion-x/build/third-party/equation').then((m) => m.Equation)
124+
import('react-notion-x/build/esm/third-party/equation').then(
125+
(m) => m.Equation
126+
)
125127
)
126128
const Pdf = dynamic(
127-
() => import('react-notion-x/build/third-party/pdf').then((m) => m.Pdf),
129+
() => import('react-notion-x/build/esm/third-party/pdf').then((m) => m.Pdf),
128130
{
129131
ssr: false
130132
}
131133
)
132134
const Modal = dynamic(
133-
() => import('react-notion-x/build/third-party/modal').then((m) => m.Modal),
135+
() =>
136+
import('react-notion-x/build/esm/third-party/modal').then((m) => m.Modal),
134137
{
135138
ssr: false
136139
}

0 commit comments

Comments
 (0)