xxxxxxxxxx
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.33.0/min/vs/editor/editor.main.js" ></script>
xxxxxxxxxx
$ npm i monaco-editor@0.34.1
<div id='editor' style="width:700px; height: 800px;"></div>
<script src="node_modules/monaco-editor/min/vs/loader.js"></script>
<script>
require.config({
paths: { 'vs': 'node_modules/monaco-editor/min/vs' }
})
require(['vs/editor/editor.main'], () => {
let editor = monaco.editor.create(document.getElementById('editor'), {
value: 'console.log("hello world")',
language: 'javascript'
})
})
</script>