Runtime error "Cannot call a class as a function" when using version 3 & higher
See original GitHub issueHello,
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”:

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:

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:
- Created a year ago
- Reactions:1
- Comments:9

Top Related StackOverflow Question
Fixed! @CGNonofr Thank you very much!
The fix was to change the browserlist
productionconfiguration to the same values in thedevelopmentconfig (or to any recent browserlist config):Alright, i’ll check that, thanks!