NotionX / react-notion-x

Fast and accurate React renderer for Notion. TS batteries included. ⚡️
https://react-notion-x-demo.transitivebullsh.it
MIT License
4.68k stars 543 forks source link

require() of ES Module error #553

Open karishag opened 2 months ago

karishag commented 2 months ago

Description

On the server side, when using notion-client package I get the require() of ES Module not supported error. I modified tsconfig.json file compilerOptions to this:

"target": "ES2018", / Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. / "resolveJsonModule": true, / Resolve 'import x from y.json' to 'y.json'. / "module": "CommonJS"

Also installed esm module, and set "type": "module" in package.json file but nothing helps.

Notion Test Page ID

067dd719-a912-471e-a9a3-ac10710e7fdf

Screenshot 2024-05-16 at 10 49 04 AM
runticle commented 2 months ago

Hey @karishag did you find a way around this in the end? I can't switch my project to ESM so I think I need to find an alternative client, or fork this repo and un-esm it 🤷

karishag commented 1 month ago

@runticle in my case the project was CommonJS, I experimented a lot to continue using the same project but didn't work. Ultimately I've to create a new one with esm