0

I'm getting started using a Monaco Editor for an Electron JS application. So far I'm able to get the file content on a user's directory no problem but when I try to append it to a Monaco Editor is where I face this issue.

Renderer.js:

import * as monaco from 'monaco-editor';
...

// Get read file content and append it to the editor
ipcRenderer.on("display-content", function(event, data){
monaco.editor.create(document.getElementById("editor"), {
    data,
    language: "javascript",
    automaticLayout: true,
  });
}

Script and Div on index.html:

<body>
...
    <div id="editor" style="height: 75%"></div>
    <script type="module" src="renderer.js"></script>
  </body>
1
  • Why are you loading renderer.js in an HTML file? If you want to use ES modules this way, you need import maps
    – jabaa
    Commented Jun 30 at 16:38

0