vue3-popper
vue3-popper copied to clipboard
Problem when using in server side rendered page (regeneratorRuntime is not defined)
Description of the bug
Page where popper is in use does not work when server side rendered with following error:
[vite] Internal server error: regeneratorRuntime is not defined at [email protected][email protected]/node_modules/vue3-popper/dist/popper.ssr.js:1951:49
Expected behavior Expected to work as client side rendered
Additional context Add any other context about the problem here. Vite + Vue3 + vite-ssr + [email protected]
After doing some digging it seems like regeneratorRuntime is related to babel but that's about all I could find.
Got the very same problem here. Gonna look into it a bit more and see if there's any kind of sensible fix to it. Also: Bump.
Is there any update about this? i am seeing same error on my first nuxt3 application.
We solved it by forcing the import of the ESM build of the lib :
import Popper from 'vue3-popper/dist/popper.esm'
(with the proper shim declare module 'vue3-popper/dist/popper.esm')
Same issue
@itsmnthn I just switched the package with floating-vue
qnp's answer solved the issue. Also, wrapping <Popper> with <ClientOnly> solves the issue but it's to much.
@valgeirb any update on this ?
I'm using vite with vite-ssg. My workaround until vue3-popper supports native ESM is:
// vite.config.ts
ssr: {
// Workaround until they support native ESM
noExternal: ['vue3-popper'],
},
I'm using vite with vite-ssg. My workaround until vue3-popper supports native ESM is:
// vite.config.ts ssr: { // Workaround until they support native ESM noExternal: ['vue3-popper'], },
Thank you for this conf @jbaubree. If anyone is using Nuxt 3, be sure to add these options under the vite key:
vite: {
ssr: {
noExternal: ['vue3-popper'],
}
}
Is there an official solution for this issue? I am facing the same error when working with Vue and Vitest.
Installed dependencies:
At this point, the only solution I found was the one suggested by @qnp
import Popper from 'vue3-popper/dist/popper.esm'
Note: My project doesn't have installed vite-ssg.