New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loader silently fails when used on page in ASP.NET MVC "Areas" page. #41
Comments
@jhurdlow I am sorry for your troubles, the one difference I immediately see is that the URL has a different path (i.e. Do you "manually" create a What is the relevant loader config you use (i.e. It would be helpful if you could post here the relevant snippet (I'm looking for something like):
|
Yeah, the URL is different because that's how areas work, it adds another sub-path. I'm loading <script type="text/javascript" src="http://localhost/Monaco/dev/vs/loader.js"></script>
<script>
require.config({ paths: { 'vs': 'http://localhost/Monaco/dev/vs' } });
window.MonacoEnvironment = {
getWorkerUrl: function (workerId, label) {
return 'scripts/monaco-editor-worker-loader-proxy.js';
}
};
require(['vs/editor/editor.main'], function() {
var editor = monaco.editor.create(document.getElementById('container'), {
value: [
'function x() {',
'\tconsole.log("Hello Areas World!");',
'}'
].join('\n'),
language: 'javascript'
});
});
</script> That works as far as loading the |
I still haven't been able to get it to work with my primary project, but I did try and create a fresh site to use as a minimum example of the bug. I was able to get it to work properly with Areas in that fresh project, so I'm going to close the bug and assume it's a conflict with however my primary project is configured. I'll add more comments if I find anything further. |
The issue turns out to be a conflict between KnockoutJS and the Monaco loader. If KnockoutJS is loaded, then the loader fails. Further investigation will be required to determine why this is the case, and if changing load order would work around the problem. |
@jhurdlow If there is anything we can do on our side with |
I can easily use Monaco on a page hosted in the standard Views folder of an ASP.NET MVC site (like
http://localhost/MySite/Monaco
. That works great. However when I try to do the same thing on a page under an Area in my site (likehttp://localhost/MySite/Admin/Monaco
, the loader silently fails and leaves "monaco" undefined. The loader does not throw any errors, but when you try to create an editormonaco.editor.create(...)
, you get aUncaught ReferenceError: monaco is not defined
error. Watching the file loads from the browser's debugger shows that the last file loaded by the browser iseditor.main.js
(and it does load successfully, it's not an issue of it not being able to find the file); In a successful Monaco load (such as on the base site), that is followed by theeditor.main.css
andeditor.main.nls.js
files (then a whole bunch of other workers and services once we 'create' our editor). I have tried hosting the Monaco files both in the local site, as well as putting them on another site (CDN-style) and using the provided guidance to ensure web-worker support (both ways work on a standard view, but not one in an Area). I've tried it on Chrome, FFox, and IE; all three show the same behavior. In IE, if I load the page with the debugger open, it will sometimes stop on an errorObject doesn't support property or method 'create'
oneditor.main.js line 47280 column 21
, which maps tofile:///C:/Alex/src/vscode/src/vs/editor/common/services/editorSimpleWorker.ts line 315
. I don't know if that's actually related to the load failure or not. Whatever the cause, I've spend several hours trying to get this working to no avail, so I'm opening this issue.The text was updated successfully, but these errors were encountered: