datalayer / jupyter-ui

⚛️ React.js components 💯% compatible with 🪐 Jupyter - Storybook on https://jupyter-ui-storybook.datalayer.tech
https://jupyter-ui.datalayer.tech
Other
325 stars 46 forks source link

Error while trying to use Jupyter-ui in a Next.js app #237

Open Jay-Patel-257 opened 4 months ago

Jay-Patel-257 commented 4 months ago

Description

When I tried to display a Notebook Component in one of my Next.js app It resulted in a compilation error. It happened right after installing the @datalayer/jupyter-react dependency. Because of the that i decided to try the next js example code from here. That gave the same error even though I'm using Yarn V3.

Reproduce

1) clone the repo 2) yarn install 3) yarn dev

The error seems to be coming from Pyodide and I am planning to use it in future. But Idon't know how to resolve this error.

Note: My corepack is not enabled and I wasn't able to figure out how. I don't know if that is causing error.

Expected behavior

The app to compile normally without error.

Context

Browser Output
hydration-error-info.ts:72 
 ./node_modules/@jupyterlite/pyodide-kernel/pypi/widgetsnbextension-4.0.10-py3-none-any.whl
Module parse failed: Unexpected character '' (1:2)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)

It would be great if anybody could address this issue.

echarles commented 4 months ago

Just replied on https://github.com/datalayer-examples/jupyter-nextjs-example/issues/4#issuecomment-2139401440

mattmutt commented 4 months ago

For the purposes of debugging, does this help?

I was seeing reference errors inside the app's page.tsx for ColorMode. It's import statements can be shortened too.

echarles commented 4 months ago

the next-js example in this repos aims to depend on the jupyter-react source changes. If you remove the "@datalayer/jupyter-react": "workspace:^", the yarn install will pull the latest release which may not have all the source code changes. The easiest way to get started is to have a separated example project based on https://github.com/datalayer-examples/jupyter-nextjs-example