mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 12:45:39 +01:00
Add esbuild sample
This commit is contained in:
parent
3638651cde
commit
7318711606
6 changed files with 108 additions and 0 deletions
24
samples/browser-esm-esbuild/index.js
Normal file
24
samples/browser-esm-esbuild/index.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.main.js';
|
||||
|
||||
self.MonacoEnvironment = {
|
||||
getWorkerUrl: function (moduleId, label) {
|
||||
if (label === 'json') {
|
||||
return './vs/language/json/json.worker.js';
|
||||
}
|
||||
if (label === 'css' || label === 'scss' || label === 'less') {
|
||||
return './vs/language/css/css.worker.js';
|
||||
}
|
||||
if (label === 'html' || label === 'handlebars' || label === 'razor') {
|
||||
return './vs/language/html/html.worker.js';
|
||||
}
|
||||
if (label === 'typescript' || label === 'javascript') {
|
||||
return './vs/language/typescript/ts.worker.js';
|
||||
}
|
||||
return './vs/editor/editor.worker.js';
|
||||
}
|
||||
};
|
||||
|
||||
monaco.editor.create(document.getElementById('container'), {
|
||||
value: ['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
|
||||
language: 'javascript'
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue