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

Trying to use this in React project and "Blob" is not defined #36

Open
davidrhoderick opened this issue Jul 14, 2020 · 2 comments
Open

Comments

@davidrhoderick
Copy link

Looks like there is a missing dependency "Blob". How do I remedy? I tried installing blob from npm and importing it but it didn't work.

ReferenceError: Blob is not defined
    at eval (webpack-internal:///./packages/interpayments-theme/node_modules/can-autoplay/build/can-autoplay.es.js:6:14)
    at Module../packages/interpayments-theme/node_modules/can-autoplay/build/can-autoplay.es.js (/home/davidrhoderick/Development/interpayments/frontity/build/server.js:5043:1)
    at __webpack_require__ (/home/davidrhoderick/Development/interpayments/frontity/build/server.js:27:30)
    at eval (webpack-internal:///./packages/interpayments-theme/src/components/partials/page-hero.js:10:70)
    at Module../packages/interpayments-theme/src/components/partials/page-hero.js (/home/davidrhoderick/Development/interpayments/frontity/build/server.js:6116:1)
    at __webpack_require__ (/home/davidrhoderick/Development/interpayments/frontity/build/server.js:27:30)
    at eval (webpack-internal:///./packages/interpayments-theme/src/components/home.js:7:77)
    at Module../packages/interpayments-theme/src/components/home.js (/home/davidrhoderick/Development/interpayments/frontity/build/server.js:5900:1)
    at __webpack_require__ (/home/davidrhoderick/Development/interpayments/frontity/build/server.js:27:30)
    at eval (webpack-internal:///./packages/interpayments-theme/src/components/index.js:12:63)
@gkatsev
Copy link
Member

gkatsev commented Jul 14, 2020

Are you using it in SSR? Blob is available globally in browsers but not available globally in node.
This module probably isn't set up for SSR, currently.

@shlajin shlajin mentioned this issue Sep 17, 2020
@super-bunny
Copy link

You can use this workaround with Dynamic imports for SSR (tested with Next.js) until PR #38 is merged 🙂

import('can-autoplay')
  .then(module => module.default.video())
  .then(({ result }) => {
    if (result === true) {
      // Can auto-play
    } else {
      // Can not auto-play
    }
  })

goslingo added a commit to vegaprotocol/vega.xyz that referenced this issue Nov 3, 2022
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