-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Uncaught (in promise) Error: Could not find source file: 'inmemory://model/node_modules #16
Comments
Hello @dolanmiu, thank you for your report. Can you share the code you put into monaco, and the code that you used to mount monaco and attach the auto-typings plugin? |
Very simple, but I pass my own version of monaco const model = monaco.editor.createModel('', 'typescript', monaco.Uri.parse('inmemory://model/widget.tsx'));
model.updateOptions({ tabSize: 2 });
this.editor = monaco.editor.create(this.editorContainer.nativeElement, {
model,
language: 'typescript',
theme: 'vs-dark',
automaticLayout: true,
});
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
...monaco.languages.typescript.typescriptDefaults.getCompilerOptions(),
// eslint-disable-next-line @typescript-eslint/no-explicit-any
jsx: 'react' as any,
lib: ['dom', 'esnext'],
});
this.autoTypings = await AutoTypings.create(this.editor, {
monaco,
sourceCache: storage, // Cache loaded sources in localStorage. May be omitted
onUpdate: (u, t) => {
if (u.type === 'StoredToCache' || u.type === 'LoadedFromCache') {
for (const origin of CONSUMER_SPA_ORIGINS) {
this.window.postMessage([t], origin);
}
}
},
onError: (e) => {
for (const origin of CONSUMER_SPA_ORIGINS) {
this.window.postMessage([e], origin);
}
},
}); |
Can you try to add the following to the compiler options:
and if you're not already doing that, maybe also try importing AutoTypings from |
applying these steps fixed it for me, without specifying |
I can see the models are there, but probably not attached to the editor or something?
The text was updated successfully, but these errors were encountered: