Add an electron esm sample

This commit is contained in:
Alexandru Dima 2020-12-30 10:04:21 +01:00
parent 830e5bbd42
commit 72e42c9b4b
No known key found for this signature in database
GPG key ID: 6E58D7B045760DA0
6 changed files with 122 additions and 0 deletions

View file

@ -0,0 +1,24 @@
import * as monaco from 'monaco-editor';
self.MonacoEnvironment = {
getWorkerUrl: function (moduleId, label) {
if (label === 'json') {
return './json.worker.bundle.js';
}
if (label === 'css' || label === 'scss' || label === 'less') {
return './css.worker.bundle.js';
}
if (label === 'html' || label === 'handlebars' || label === 'razor') {
return './html.worker.bundle.js';
}
if (label === 'typescript' || label === 'javascript') {
return './ts.worker.bundle.js';
}
return './editor.worker.bundle.js';
}
};
monaco.editor.create(document.getElementById('container'), {
value: ['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
language: 'javascript'
});