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.

Runtime error "Cannot call a class as a function" when using version 3 & higher

See original GitHub issue

Hello,

I’m using this library alongside with react & it works perfectly on dev mode, but once i build the app for production use, i receive the following error on runtime “Cannot call a class as a function”:

Screen Capture_select-area_20220921224751

The error only occurs with recent versions on this library (to know version 3 & 4), i tested with version 2 & i don’t get any error at runtime (still upgrading to the latest version is needed to get the latest features & to keep monaco version updated as well).

After investigating, the error seems to come from the super call in the RawContextKey class in the monaco-editor/esm/vs/platform/contextkey/common/contextkey.js file:

Screen Capture_select-area_20220921225704

I also noticed that the same class is bundled in vscode/dist/workspace.js file of the @codingame/monaco-vscode-api package, so i’m wondering if the issue is coming from the fact that the class is declared twice, or maybe something else like the babel @babel/runtime/helpers/esm/createSuper.js module which is used/called just before the error occurs.

That’s all i could figure out, any help to fix that issue would be appreciated 🙏 .

Thanks.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

1reaction
AXeL-devcommented, Sep 28, 2022

Fixed! @CGNonofr Thank you very much!

The fix was to change the browserlist production configuration to the same values in the development config (or to any recent browserlist config):

Screen Capture_select-area_20220922104655

0reactions
AXeL-devcommented, Sep 22, 2022

Alright, i’ll check that, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting "Cannot call a class as a function" in my React Project
I got this error because I was using React Router v4 and I accidentally used the render prop instead of the component one...
Read more >
Cannot call a class as a function" when using layers the React ...
When I'm trying to use Deck.gl along with ReactMapGl to render some layers onto a map, I'm getting this error: scatterplot-layer.js:22 Uncaught ...
Read more >
TypeError: Cannot call a class as a function error | Angular ...
I tried to implement daterange picker component with Angular 9 project. ... ERROR Error: Uncaught (in promise): TypeError: Cannot call a ...
Read more >
Guide for running C# Azure Functions in an isolated worker ...
Learn how to use a .NET isolated worker process to run your C# functions in Azure, which supports non-LTS versions of .NET and...
Read more >
this - JavaScript | MDN
Class constructors are always called with new , so their behavior is the same as function constructors: the this value is the new...
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