question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] regeneratorRuntime is not defined

See original GitHub issue

Describe the bug After updating @typeform/embed in a Gatsby project from v0.33.2 to v0.34.5 and either running develop or production mode the following error is thrown:

  WebpackError: ReferenceError: regeneratorRuntime is not defined
  
  - lib.pure.js:1 
    node_modules/@typeform/embed/build/lib.pure.js:1:41435

To Reproduce Steps to reproduce the behavior:

Install @typeform/embed @ v0.34.5in a Gatsby project, add it as described & run yarn build (or yarn develop then it’s shown in the Browser). (But probably with many a React App).

Expected behavior Typeform doesn’t throw an error ; ).

Desktop (please complete the following information):

  System:
    OS: Linux 5.4 Linux Mint 20.1 (Ulyssa)
    CPU: (8) x64 Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 14.15.3 - ~/.nvm/versions/node/v14.15.3/bin/node
    Yarn: 1.22.4 - /usr/bin/yarn
    npm: 7.5.2 - ~/.nvm/versions/node/v14.15.3/bin/npm
  Browsers:
    Chrome: 87.0.4280.88
    Firefox: 85.0
  npmPackages:
    gatsby: ^2.32.3 => 2.32.3

Additional context I know you state in the README that no polyfills are included, but you might perhaps add that @babel/plugin-transform-runtime is needed. But as it quite increases the bundle size, I refrain from it and stay @ v0.33.2.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:10

github_iconTop GitHub Comments

3reactions
daviddelusenetcommented, Feb 17, 2021

So I managed to fix it by using the approach of Ciccio99 in issue #132. My code for if anyone ever gets here:

import { useCallback, useEffect, useRef } from 'react'
import { Popup } from '@typeform/embed'

export const useEarlyAccessForm = (): {
  openForm: () => void
} => {
  const formRef = useRef<Popup | null>(null)

  useEffect(() => {
    ;(async () => {
      const { makePopup } = await import('@typeform/embed')

      formRef.current = makePopup(
        'MY_FORM_URL,
        {
          size: 90,
        },
      )
    })()
  }, [])

  const openForm = useCallback(() => {
    formRef.current?.open()
  }, [formRef])

  return {
    openForm,
  }
}

0reactions
stale[bot]commented, Mar 3, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix regeneratorRuntime is not defined?
I have ran into a problem, the error is regeneratorRuntime is not defined while working with React and Parcel bundler.
Read more >
Babel 6 regeneratorRuntime is not defined - Stack Overflow
This error is caused when async/await functions are used without the proper Babel plugins. As of March ...
Read more >
ReferenceError regeneratorRuntime is not defined · Issue #9849
I'm building an SSR template, and when I use @babebl/register and then execute webpack (config), the system reported an error.
Read more >
Parcel, how to fix the `regeneratorRuntime is not defined` error
I run into this problem in a project using Babel as soon as I added an async function, but the problem is the...
Read more >
regeneratorRuntime is not defined - WordPress.org
So if you are lazy loading the player dependencies, then it looks like there may be an error since they don't exist (though...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found