1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Desktop: Beta editor plugin API: Fix plugins unable to require nodeJS modules (#9968)

This commit is contained in:
Henry Heino 2024-02-22 07:39:46 -08:00 committed by GitHub
parent 1b846fca90
commit 4c5e708977
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,6 +42,12 @@ const codeMirrorRequire = (library: string) => {
return libraryNameToPackage[library];
}
// Although window.require doesn't work on mobile, some desktop-only plugins
// originally developed for CodeMirror 5 rely on it.
if (typeof window.require === 'function') {
return window.require(library);
}
throw new Error(`Cannot find library ${library}`);
};