monaco-react icon indicating copy to clipboard operation
monaco-react copied to clipboard

new version,updated on 10.13 has bug

Open DylanYang01 opened this issue 6 months ago • 17 comments

always show loading, value is not shown

DylanYang01 avatar Oct 13 '25 06:10 DylanYang01

what version do you use? could please share the console error if possible?

suren-atoyan avatar Oct 13 '25 07:10 suren-atoyan

I've not taken a closer look into the issue, but it appears as this issue originates in '@monaco-editor/loader' at version 1.6.0, as my vite bundler throws the following error:

SyntaxError: The requested module '@monaco-editor/loader' does not provide an export named 'default'

When overriding the version of @monaco-editor/loader to 1.5.0, this error dissapears.

This also occurs for the current version 4.7.0 when being newly installed, probably caused be the used version selector.

TobiasPressler avatar Oct 13 '25 09:10 TobiasPressler

I've not taken a closer look into the issue, but it appears as this issue originates in '@monaco-editor/loader' at version 1.6.0, as my vite bundler throws the following error:

SyntaxError: The requested module '@monaco-editor/loader' does not provide an export named 'default'

When overriding the version of @monaco-editor/loader to 1.5.0, this error dissapears.

This also occurs for the current version 4.7.0 when being newly installed, probably caused be the used version selector.

same error here, downgrade loader to 1.5.0 fixed this problem, maybe related to https://github.com/microsoft/monaco-editor/releases/tag/v0.54.0

DearTanakorn avatar Oct 13 '25 14:10 DearTanakorn

I've just set up a new project (with the latest Vite, TS + React) and used v4.8.0-rc.1. Don't see any issues 🤔cc @DearTanakorn @TobiasPressler @DylanYang01

Could you please share more info about your setup?

suren-atoyan avatar Oct 13 '25 16:10 suren-atoyan

Same here (during vitest). Maybe related to https://github.com/suren-atoyan/monaco-loader/issues/56 ? this alias in vite.config seems to help handling it:

resolve: {
      alias: {
           '@monaco-editor/loader': '@monaco-editor/loader/lib/es/index.js',
      },
}

lazToum avatar Oct 13 '25 17:10 lazToum

Same issue with latest release, vite, (TS + React), Error : exports is not defined in ES module scope. This happens because the loader package isn’t marked properly as ESM-compatible.

Arghadeep09 avatar Oct 14 '25 12:10 Arghadeep09

Image Image The current tag no longer matches.

GuoMouMo avatar Oct 14 '25 12:10 GuoMouMo

Same issue with latest release, vite, (TS + React), Error : exports is not defined in ES module scope. This happens because the loader package isn’t marked properly as ESM-compatible.

I am having an issue reproducing this. I've just tried it with Vite v5, 6 and 7

Could you please show how you use (+import) this package?

suren-atoyan avatar Oct 14 '25 12:10 suren-atoyan

I've just set up a new project (with the latest Vite, TS + React) and used v4.8.0-rc.1. Don't see any issues 🤔cc @DearTanakorn @TobiasPressler @DylanYang01

Could you please share more info about your setup?

My Project Setup

  • Project Structure : Single Repo
  • NextJS : v15.5.5
  • React : v19.2.0
  • NodeJS : v24.8.0
  • TypeScript : v5.9.3

While building in Collecting page data phase :

✓ Compiled successfully in 15.3s
   Collecting page data  .[ReferenceError: exports is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/Users/deartanakorn/Github/xxxx/xxxxx/node_modules/.pnpm/@[email protected]/node_modules/@monaco-editor/loader/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.]

DearTanakorn avatar Oct 14 '25 12:10 DearTanakorn

ok, both packages are updated:

  • @monaco-editor/loader - v1.6.1
  • @monaco-editor/react - v4.8.0-rc.2

Please try them and let me know if the issue is solved.

Thanks, everyone~

suren-atoyan avatar Oct 14 '25 13:10 suren-atoyan

i have resolve it by localize the monaco-deditor like this:

import * as monaco from 'monaco-editor'; loader.config({ monaco });

DylanYang01 avatar Oct 14 '25 13:10 DylanYang01

ok, both packages are updated:

  • @monaco-editor/loader - v1.6.1
  • @monaco-editor/react - v4.8.0-rc.2

Please try them and let me know if the issue is solved.

Thanks, everyone~

solved.

DearTanakorn avatar Oct 14 '25 16:10 DearTanakorn

I rolled back my version, here is my version combination. Perhaps it may be some help to those who see this issue.

  "pnpm": {
    "overrides": {
      "monaco-editor": "0.51.0",
      "@monaco-editor/loader": "1.5.0",
      "@monaco-editor/react": "4.7.0",
     }
   }

SoonIter avatar Oct 15 '25 03:10 SoonIter

ok, both packages are updated:

  • @monaco-editor/loader - v1.6.1
  • @monaco-editor/react - v4.8.0-rc.2

Please try them and let me know if the issue is solved.

Thanks, everyone~

In this version, the monaco I got is undefined.

Image

FailIsNorm avatar Oct 15 '25 14:10 FailIsNorm

I rolled back my version, here is my version combination. Perhaps it may be some help to those who see this issue.

"pnpm": { "overrides": { "monaco-editor": "0.51.0", "@monaco-editor/loader": "1.5.0", "@monaco-editor/react": "4.7.0", } }

have you tried the latest version?

suren-atoyan avatar Oct 15 '25 16:10 suren-atoyan

ok, both packages are updated:

  • @monaco-editor/loader - v1.6.1
  • @monaco-editor/react - v4.8.0-rc.2

Please try them and let me know if the issue is solved. Thanks, everyone~

In this version, the monaco I got is undefined.

Image

Here I checked it with the latest version; check the console to see the monaco instance.

Could you please try to reproduce your case in this codesandbox?

suren-atoyan avatar Oct 15 '25 16:10 suren-atoyan

For those who’re loading monaco-editor from a custom path like below:

import { loader } from '@monaco-editor/react';

// you can change the source of the monaco files
loader.config({ paths: { vs: '...' } });

you need to ensure the version of @monaco-editor/loader and the version of monaco-editor are compatible. @monaco-editor/loader v1.6.0, v.1.6.1 are incompatible with monaco-editor below v0.53.0(more details here).

If you ran into the compatibility issue above, either downgrade @monaco-editor/loader or upgrade monaco-editor.

jddxf avatar Oct 16 '25 07:10 jddxf