felixrieseberg / monaco-loader

:package: Load the Monaco editor with a module loader (require, import, etc)
Other
36 stars 3 forks source link

Error while loading. #1

Open smorzhov opened 7 years ago

smorzhov commented 7 years ago

I'm trying to load monaco-editor in ember-electron with these code:

const _loader = require('monaco-loader');
let code = this.get('monaco').getCode();
_loader().then((monaco) => {
let editor = monaco.editor.create(document.getElementById('container'), {
    language: 'javascript',
    theme: 'vs',
    automaticLayout: true,
    value: [code].join("\n")
});

It loads the editor somehow - the monaco window appears where I can type in some code; highliting and everything else are also working fine. But there is a strange error - Error: Could not find module 'vs/language/typescript/src/worker' imported from (require). The error occurs in ember-electron index.html file in line return requireAMD.apply(null, arguments) Arguments is an Array, that contains 1 entry - string "vs/language/typescript/src/worker". These error is caught but the line return requireNode.apply(null, arguments) in the catch block is also fails because node require must get a string argument. So, I got this error.

AssertionError {name: "AssertionError", actual: false, expected: true, operator: "==", message: "path must be a string"…}

It appears in the developer tools every time I type in even a letter in the monaco editor window.

How can I fix it?

smorzhov commented 7 years ago

requireNode(['../node_modules/monaco-editor/min/vs/language/typescript/src/worker.js'']) returns an Object.

KseniaLV commented 7 years ago

Same problem

corasan commented 7 years ago

Did you fix this?