Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxt-edge Object(...)() is null / context is null #644

Closed
1 task done
niklv opened this issue Aug 7, 2022 · 8 comments
Closed
1 task done

Nuxt-edge Object(...)() is null / context is null #644

niklv opened this issue Aug 7, 2022 · 8 comments

Comments

@niklv
Copy link

niklv commented Aug 7, 2022

Confirmation

  • I can confirm this problem is not reproducible with ECharts itself.

How are you introducing Vue-ECharts into your project?

ES Module imports

Versions

Details

I have a project with vue-echart and nuxt 2 (version 2.15).
I try to start migration to nuxt 3. First steps is to upgrade nuxt to nuxt-edge. It requires to remove @nuxtjs/composition-api cause Nuxt 2.16 is based on Vue 2.7. At this step I expect that all will run fine. Cause Vue 2.7 supports composition API.
But it not.

Here is my browser console output:
изображение

There are serveral warnings:
[Vue warn]: inject() can only be used inside setup() or functional components.
[Vue warn]: globally imported h() can only be invoked when there is an active component instance, e.g. synchronously in a component's render or setup function.
[Vue warn]: The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>. Bailing hydration and performing full client-side render.

And two errors:
TypeError: Object(...)() is null
and
TypeError: context is null

Reproduction

https://github.com/niklv/nuxt_echarts_bug

@warflash
Copy link

Oh hey, a fellow nuxt bridge user^^
Did not get vue-echarts running in bridge so far either. Running into the error I described in #639 so just adding that onto here for reference I guess

@niklv
Copy link
Author

niklv commented Aug 10, 2022

Hi @warflash
You can check my repo, that there are no nuxt-bridge at this point.

@warflash
Copy link

Oh actually, looking at your repro repo it does seem like you're missing a few nuxt and bridge specific things. This comment here shows an example of making vue-echarts work on nuxt3 https://github.com/nuxt/framework/discussions/2474#discussioncomment-1850092 but I did not find a way to make it work on bridge yet

@niklv
Copy link
Author

niklv commented Aug 11, 2022

Please, check repo again. I actually use nuxt 2 (nuxt-edge is actually nuxt 2.16 with Vue 2.7 inside).
I use nuxt-edge as intermediate step to migrate to nuxt bridge. https://v3.nuxtjs.org/bridge/overview#upgrade-nuxt-2
After I upgrade to nuxt-edge. All my code should work fine to proceed to next steps.

Once the installation is complete, make sure both development and production builds are working as expected before proceeding.

All other my codebase works fine except vue-echarts. So I create minimal repoduction exaple to report bug that vue-echart not works with nuxt-edge (aka nuxt 2.16 that will be released in a few months)

@Justineo
Copy link
Member

Try add this to nuxt.config.js as a workaround:

{
  alias: {
    vue: 'vue/dist/vue.runtime.esm.js'
  }
}

@niklv
Copy link
Author

niklv commented Aug 11, 2022

@Justineo thank you, workaround is working!
Is there any plans to fix this in upcoming releases?

@Justineo
Copy link
Member

Not sure there's anything can be done on our side. It seems that with Nuxt's webpack config, the imported vue from vue-demi refers to the cjs version.

@Justineo
Copy link
Member

Closing as a workaround is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants