makenotion / notion-sdk-js

Official Notion JavaScript Client
https://developers.notion.com/docs
MIT License
4.96k stars 593 forks source link

Simply importing notion into an Astro project doesn't work #447

Open tadaspetra opened 1 year ago

tadaspetra commented 1 year ago

Describe the bug Adding this script tag to an Astro project, causes it to not run the script at all.

<script>
  import { Client } from "@notionhq/client";
  console.log("notion")
  const notion = new Client({ auth: "<secret>"});
</script>

And shows this error on the client

Uncaught SyntaxError: The requested module '/node_modules/@notionhq/client/node_modules/whatwg-url/lib/public-api.js?v=0c9a2969' does not provide an export named 'default' (at index.mjs?v=0c9a2969:4:8)

To Reproduce Node version: v16.14.2 Notion JS library version: ^2.2.11

Steps to reproduce the behavior: Import Client from library

a-barbieri commented 8 months ago

It happens also when importing the library on a react component in Astro.