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.

Unexpected token error from Regions plugin on 5.0.0

See original GitHub issue

Wavesurfer.js version(s):

5.0.0

Browser and operating system version(s):

Firefox 88, macOS Big Sur

Code needed to reproduce the issue:

Next.js v10.1.3.

const regions = RegionsPlugin.create({});
const plugins = [regions];
...
wavesurfer.current = WaveSurfer.create({
      container: ref.current,
      height: 200,
      plugins,
    });

Use behaviour needed to reproduce the issue:

I came from 4.6.0 where this isn’t an issue.

./node_modules/wavesurfer.js/src/plugin/regions/region.js 46:47
Module parse failed: Unexpected token (46:47)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|         this.data = params.data || {};
|         this.attributes = params.attributes || {};
>         this.showTooltip = params.showTooltip ?? true;
| 
|         this.maxLength = params.maxLength;

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
gavrichardscommented, May 5, 2021

Ok fair enough, thanks for your help.

0reactions
n0mn0mcommented, Oct 14, 2021

Thanks @caugner. I do have the types installed, and for just WaveSurfer things work and I get the media element.

I started using the imports based on the jest test (to add plugins), and ran into the nullish operator error at the top of this issue. Doing some more reading last night I think I’m running into this issue. I’m going to test some of the suggestions there, but I may have to customize babel a bit to get this all working. Thanks for the links!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuxt Error: Syntax Unexpected token export after installation
I just checked your issue and it happens when you use element UI with Nuxt. Update your Nuxt configuration like this(Andrew Answer):
Read more >
My server Error Unexpected token '<' - Forums - Unraid
This sounds like a CORS error, are you using a reverse proxy? Those are not currently supported. If you look at the ALLOWED_ORIGINS...
Read more >
SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >
SyntaxError: Unexpected token '<' on new build of React
I have a React application and every time I deploy it to digital ocean I'm getting this error SyntaxError: Unexpected token '<', but...
Read more >
Error: undefined Unexpected token < in JSON at position 0 ...
The only way to be certain that it is not the case is to just enable a default theme for a few min,...
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