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

Can't get it working with Vite in Nuxt 3 #212

Open
priverop opened this issue Feb 8, 2023 · 0 comments
Open

Can't get it working with Vite in Nuxt 3 #212

priverop opened this issue Feb 8, 2023 · 0 comments

Comments

@priverop
Copy link

priverop commented Feb 8, 2023

Hello, I'm trying to create a Vite Library with Vue-Demi to work in Nuxt 2 and Nuxt 3.

I guess I'm missing something. I've seen a lot of examples but I don't know what I'm doing wrong.

Here is the repo with the examples and errors.

After running yarn install && yarn dev in both the lib-consumer projects it works fine in Nuxt 2 but it doesn't work in Nuxt 3.

nuxt.config.ts

export default defineNuxtConfig({
    build: {
        transpile: ['@prp-astara/vite-test-lib'],
    },
})
[Vue warn]: Property "_self" was accessed during render but is not defined on instance.                                                                                                                                                                                13:18:50
[Vue warn]: Unhandled error during execution of render function                                                                                                                                                                                                        13:18:50
  at <Anonymous>
[nitro] [dev] [unhandledRejection] TypeError: Cannot read properties of undefined (reading '_c')                                                                                                                                                                       13:18:50
    at Proxy.$ (/vue-demi-vite-with-nuxt/nuxt3-lib-consumer/node_modules/@prp-astara/vite-test-lib/dist/vite-test-lib.umd.js:1:1163)
    at renderComponentRoot (/vue-demi-vite-with-nuxt/nuxt3-lib-consumer/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:906:44)                                                                                                       13:18:41
    at renderComponentSubTree (/vue-demi-vite-with-nuxt/nuxt3-lib-consumer/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:719:51)
    at renderComponentVNode (/vue-demi-vite-with-nuxt/nuxt3-lib-consumer/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:644:16)
    at Module.ssrRenderComponent (/vue-demi-vite-with-nuxt/nuxt3-lib-consumer/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:94:12)
    at _sfc_ssrRender (/vue-demi-vite-with-nuxt/nuxt3-lib-consumer/app.vue:23:31)
    at renderComponentSubTree (/vue-demi-vite-with-nuxt/nuxt3-lib-consumer/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:710:17)
    at renderComponentVNode (/vue-demi-vite-with-nuxt/nuxt3-lib-consumer/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:644:16)
    at Module.ssrRenderComponent (/vue-demi-vite-with-nuxt/nuxt3-lib-consumer/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:94:12)
    at default (/vue-demi-vite-with-nuxt/nuxt3-lib-consumer/node_modules/nuxt/dist/app/components/nuxt-root.vue:63:37)

This is the exact issue I had when you try to get Vue 2 working in Nuxt 3.

Thank you

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

1 participant