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.

ERROR in reactPlayerDailyMotion.js from Terser

See original GitHub issue

Current Behavior

Building with webpack results in error messages:

    ERROR in reactPlayerDailyMotion.js from Terser
    Unexpected token: punc (:) [reactPlayerDailyMotion.js:3,9]

    ERROR in reactPlayerFacebook.js from Terser
    Unexpected token: punc (:) [reactPlayerFacebook.js:3,9]

    ERROR in reactPlayerFilePlayer.js from Terser
    Unexpected token: punc (:) [reactPlayerFilePlayer.js:3,9]

    ERROR in reactPlayerMixcloud.js from Terser
    Unexpected token: punc (:) [reactPlayerMixcloud.js:3,9]

    ERROR in reactPlayerSoundCloud.js from Terser
    Unexpected token: punc (:) [reactPlayerSoundCloud.js:3,8]

    ERROR in reactPlayerStreamable.js from Terser
    Unexpected token: punc (:) [reactPlayerStreamable.js:3,9]

    ERROR in reactPlayerTwitch.js from Terser
    Unexpected token: punc (:) [reactPlayerTwitch.js:3,9]

    ERROR in reactPlayerVidyard.js from Terser
    Unexpected token: punc (:) [reactPlayerVidyard.js:3,9]

    ERROR in reactPlayerVimeo.js from Terser
    Unexpected token: punc (:) [reactPlayerVimeo.js:3,9]

    ERROR in reactPlayerWistia.js from Terser
    Unexpected token: punc (:) [reactPlayerWistia.js:3,9]

    ERROR in reactPlayerYouTube.js from Terser
    Unexpected token: punc (:) [reactPlayerYouTube.js:3,8]

    ERROR in 12.js from Terser
    Unexpected token: punc (:) [12.js:3,8]

Expected Behavior

Compile

Steps to Reproduce

  1. I’ve installed the new 2.1.1 version (2.0.1 works)
  2. Imported ReactPlayer the same way as in example (I don’t use any advanced features and let ReactPlayer do all the heavy lifting
import ReactPlayer from 'react-player';

export function VideoPlayer({
  url,
  volume,
  onPlayerStartsPlaying,
}) {

  return (
    <div class="fixed">
      <ReactPlayer
        width="100%"
        height="100%"
        url={url}
        playing
        volume={volume}
        onStart={onPlayerStartsPlaying}
      />
    </div>
  );
}

Environment

No bundle output so no browser or url passed in for testing webpack: 4.42.1 react-player: 2.1.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
cookpetecommented, Jun 7, 2020

You should not have this issue in 2.2.0. The lazy loading version with import() statements is now opt-in and imported using react-player/lazy.

1reaction
cookpetecommented, Jun 7, 2020

Yeah, 2.1.0 tried to “fix” lazy loaded players by no longer transforming import() statements into require() statements (which rendered lazy loading useless). Unfortunately it breaks for any build pipeline that doesn’t support import() statements or the chunks they produce (like yours, or this one).

I’m going to release 2.2.0 shortly that reverts the main react-player import to how things were in 2.0.1, which should fix most problems for most users. Then, if your build system supports import() statements you can import from react-player/lazy.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERROR in reactPlayerDailyMotion.js from Terser #912 - GitHub
Current Behavior Building with webpack results in error messages: ERROR in reactPlayerDailyMotion.js from Terser Unexpected token: punc ...
Read more >
Debugging Story: Build failed, error from Terser - Tan Li Hau
It all started with an error message during the build: 'ERROR in bundle.xxx.js from Terser'.
Read more >
ERROR in main.js from Terser when compiling with webpack
RESOLVED: This was an error with assignment where I was assigning process.end.NODE_ENV to a string, which was being compiled into two string ...
Read more >
Resolving "Failed to minify the bundle" Errors - CircleCI Support
TerserWebpackPlugin. The following error message is usually related to running out of memory during a job: Failed to minify the bundle.
Read more >
terser-webpack-plugin | Yarn - Package Manager
Fast, reliable, and secure dependency management.
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