NotionX / NotionX/react-notion-x

require() issue on Next.js 13

Open
#406 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.4k
Forks
645
PR merge metrics
No merged PRs in 30d

Description

Description

Trying to render Notion pages in Next.js 13, running into this error:

localhost30000bf617f4fbaf40ecbd58f7bceb29cfff-Thursday-November-17-2022-12 05 40PM@2x

Here's the code:

import { NotionAPI } from 'notion-client';
import { use } from 'react';
import { NotionRenderer } from 'react-notion-x';

const notion = new NotionAPI();

async function getNotionPage(id: string) {
    let recordMap = await notion.getPage(id);
    return recordMap;
}
export default function Page({ params }: { params: { id: string } }) {
    let recordMap = use(getNotionPage(params.id));
    console.log({ recordMap });
    return (
        <NotionRenderer
            recordMap={recordMap}
            fullPage={true}
            darkMode={false}
        />
    );
}

Here's the directory tree:
page tsx — personal-site-Thursday-November-17-2022-12 06 38PM@2x

Notion Test Page ID

https://www.notion.so/witholdfriends/jm-sv-0bf617f4fbaf40ecbd58f7bceb29cfff

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided Page component and reproduce the require() error in a Next.js 13 app using the shown notion-client, react, and react-notion-x imports. Trace which dependency or rendering boundary triggers the error; done means the Notion test page renders without the reported error, with a regression check if the repository provides one.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, react, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.