vue3-popper icon indicating copy to clipboard operation
vue3-popper copied to clipboard

Problem when using in server side rendered page (regeneratorRuntime is not defined)

Open eric-2d opened this issue 3 years ago • 11 comments

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.

eric-2d avatar Feb 18 '22 13:02 eric-2d

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.

SebastianBoergers avatar Apr 14 '22 11:04 SebastianBoergers

Is there any update about this? i am seeing same error on my first nuxt3 application.

LynxTR avatar May 25 '22 17:05 LynxTR

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')

qnp avatar May 27 '22 16:05 qnp

Same issue

itsmnthn avatar Jun 08 '22 18:06 itsmnthn

@itsmnthn I just switched the package with floating-vue

LynxTR avatar Jun 08 '22 18:06 LynxTR

qnp's answer solved the issue. Also, wrapping <Popper> with <ClientOnly> solves the issue but it's to much.

itsmnthn avatar Jun 08 '22 18:06 itsmnthn

@valgeirb any update on this ?

jbaubree avatar Oct 15 '22 13:10 jbaubree

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'],
  },

jbaubree avatar Oct 15 '22 13:10 jbaubree

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'],
  }
}

icarusgk avatar Dec 18 '22 21:12 icarusgk

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.

juancampuzano avatar Mar 30 '23 10:03 juancampuzano