<!DOCTYPE html>
<html>
<head>
<script data-require="jquery@2.2.4" data-semver="2.2.4" src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script data-require="monaco@0.7.0" src="https://unpkg.com/monaco-editor@0.7.0/min/vs/loader.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body>
<h1>NoEmitOnError</h1>
To reproduce issue just modify code and see console.log.<br/>
No code is emitted even if code has no error!<br/><br/>
<div id="container" style="height:200px"></div>
</body>
</html>
// Code goes here
require.config({ paths: { 'vs': 'https://unpkg.com/monaco-editor@0.7.0/min/vs' }});
require(['vs/editor/editor.main'], function() {
var compilerOptions = {
noLib: true,
allowNonTsExtensions: true,
noEmitOnError: true
};
let editorOptions = {
value: [
'var sample:string = "test sample";'
].join('\n'),
language: "typescript"
};
monaco.languages.typescript.typescriptDefaults.setCompilerOptions(compilerOptions);
var codeEditor = monaco.editor.create(document.getElementById('container'), editorOptions);
codeEditor.getModel().onDidChangeContent(function(e) {
monaco.languages.typescript.getTypeScriptWorker()
.then(function(worker) {
worker(codeEditor.getModel().uri)
.then(function(client) {
client.getEmitOutput(codeEditor.getModel().uri.toString())
.then(function(result) {
// Result empty - even if compilation is ok!
console.log(result);
});
})})});
});
/* Styles go here */