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

Consistently getting "TypeError: window.Map is not a constructor" #81

Open
Johrten opened this issue Oct 13, 2020 · 1 comment
Open

Comments

@Johrten
Copy link

Johrten commented Oct 13, 2020

I import like:
import ReactPlayerLoader from '@brightcove/react-player-loader';

And return:

<ReactPlayerLoader
        accountId={accountId}
        playerId={playerId}
        videoId={videoId}
        onSuccess={onSuccess}
        attrs={{
          className: classNames(theme.video, 'data-vjs-player',
            { [styles.loop]: loop }),
          id: playerElementId,
          'data-embed': 'default',
          'data-account': accountId,
          'data-video-id': videoId,
          'data-player': playerId,
          'data-disable-ima3': disableAds || loop,
          'data-disable-plugindev': disableContinuousPlay || loop,
          'data-autoplay': disableAutoplay,
          'data-viewplay': disableViewplay,
          'data-stickyplay': stickyPlayerOff,
          'data-is-lead': isLeadVideo,
        }}
        embedOptions={{
          responsive: true,
          pip: true,
        }}
        options={{
          autoPlay: silentlyAutoplay && ! disableAutoplay,
          muted: false,
          playsInline: true,
          controls: true,
        }}
      />

But nothing I do or change stops me from receiving TypeError: window.Map is not a constructor attributed to /node_modules/@brightcove/react-player-loader/dist/brightcove-react-player-loader.cjs.js:619:19

Changing that map to an object appears to be the only fix locally

@Johrten
Copy link
Author

Johrten commented Oct 14, 2020

Alrighty, closing this and with the following solution for isomorphic react designes:

const ReactPlayerLoader = [check if node] && require('@brightcove/react-player-loader');

And switching the component in the return from <ReactPlayerLoader> to <ReactPlayerLoader.default>

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