qlik-oss / nebula.js

Product and framework agnostic integration APIs for Qlik's Associative Engine
https://qlik.dev/extend/set-up-nebula-environment/
MIT License
77 stars 57 forks source link

Attempted import error: 'embed' is not exported from '@nebula.js/stardust' (imported as 'embed') #1635

Open danverbs opened 1 month ago

danverbs commented 1 month ago

🐛 Bug report

I'm trying to implement nebula in my NextJs 14 app but I cannot get the package to run at all I keep getting this error:

Attempted import error: 'embed' is not exported from '@nebula.js/stardust' (imported as 'embed')

Steps to Reproduce

Expected behavior

I've used the same process using a non-NextJs app (React v17) which works fine

Is this an issue with Next, React version or something else?

danverbs commented 1 month ago

Just an extra note - if I run this with turbopack '--turbo' added to the dev script, it runs fine and the chart renders as expected. Without --turbo it doesn't load at all

danverbs commented 1 month ago

I've managed to narrow down the latest working version in our project. We're using Next so having to dynamically import the libraries so we don't get any client-side requirement errors:

        const { embed } = await import('@nebula.js/stardust');
        const barChart = (await import('@nebula.js/sn-bar-chart')).default;

Everything works up to v4.2.4, however every version from v4.3.0 onwards gives us the Attempted import error: 'embed' is not exported from '@nebula.js/stardust' error

Were there any changes to the embed import we need to be aware of/implement a change in how we import?

Other things we tried: -importing from '@nebula.js/stardust/dist/stardust' gets rid of the error but then the barchart obviously breaks -running nextjs in turbopack 'next dev --turbo' seems to work but it breaks on build

Are there plans to make this nextjs compatible?

Happy to discuss/share code as needed

Caele commented 1 week ago

Hello, sorry for not answering sooner. From what I can see in the diff (here) we didn't do anything that would explain the issue you are seeing. Its mostly dependency updates, so my guess is that one of them is the culprit. We'll see if we can reproduce this, haven't used next.js myself but if it fails with a base setup we'll make do. If you can share a codesandbox (or similar) setup, even better.

Caele commented 1 week ago

I did a test run now with a bare-bones next.js app, no issues from what I can see when simply runnig it.