Closed rohmanhm closed 7 years ago
I cannot see anything wrong in your code, but reading the error message you reported I recon the issue is in the Balel/Webpack stage
I get the same error although using a different approach:
` let req = global["require"];
let monScr = document.createElement("script");
monScr.src = "../node_modules/monaco-editor/min/vs/loader.js";
monScr.addEventListener("load", ()=> {
let amdRequire = global["require"];
global["require"] = req;
amdRequire.config({
baseUrl: Model.getInstance().appPath + '/node_modules/monaco-editor/min'
});
amdRequire(['vs/editor/editor.main'], function() {
console.log(111)
let editor = monaco.editor.create(this._html.querySelector(".module-content_raw"), {
value: [
'function x() {',
'\tconsole.log("Hello world!");',
'}'
].join('\n'),
language: 'javascript'
});
});
});
document.head.appendChild(monScr);`
It sounds like your module bundler is importing jsnext:main
from https://github.com/superRaytin/react-monaco-editor/blob/master/package.json#L9. You need to run babel over the libraries you use as well then.
Since this is an issue with your module bundler, I'm closing it here. Please reopen if you disagree.
monaco-editor version: 0.8.3 Browser: Chrome Version 57.0.2987.133 (64-bit) OS: macOS Sierra
I'm using
monaco-editor
with react and next.js Here's my codeI got error in my browser
Am I make a wrong?