BlockNote icon indicating copy to clipboard operation
BlockNote copied to clipboard

Unable to import from BlockNote packages when using `NodeNext` for `moduleResolution`.

Open danielrearden opened this issue 1 year ago • 2 comments

Describe the bug Using NodeNext as the moduleResolution value in a project's tsconfig.json breaks the ability to import from @blocknote/core, @blocknote/react and @blocknote/server-util. Any exports in those packages that use the export * from syntax are not importable and result in the error below.

Module '"@blocknote/react"' has no exported member 'Components'.ts(2305)

Mantine went through a similar issue here. The resolution there was to explicitly append the .js extension to the exports. However, I'm not 100% sure this wouldn't be a breaking change.

To Reproduce

  • Open a project using BlockNote and update the tsconfig.json to use NodeNext for module and moduleResolution.
  • Restart the TS server if necessary and review errors

Misc

  • Node version: v22.1.0
  • Package manager: pnpm
  • Browser: N/A
  • [ ] I'm a sponsor and would appreciate if you could look into this sooner than later 💖

danielrearden avatar Jul 19 '24 00:07 danielrearden

Thanks for reporting and attempting a fix @danielrearden . Could you see if https://github.com/TypeCellOS/BlockNote/pull/956 fixes the issue?

(you could copy over the built files to your project for example)

YousefED avatar Jul 19 '24 07:07 YousefED

Yes, this fixes it! Thank you for the quick response 🙏

danielrearden avatar Jul 19 '24 12:07 danielrearden