webmscore
Version:
MuseScore's libmscore in WebAssembly! Read mscz data, and generate audio/MIDI/MusicXML/SVG/PNG/PDF sheets right in browsers
24 lines (17 loc) • 657 B
JavaScript
import { createRequire } from 'module'
import { dirname } from 'path'
import { fileURLToPath } from 'url'
import { IS_NODE, shimDom } from './utils.js'
if (IS_NODE) {
// cjs require for the native Node.js ES Modules support
if (typeof require == "undefined") {
global.require = createRequire(import.meta.url)
}
// __dirname for the native Node.js ES Modules support
if (typeof __dirname == "undefined") {
global.__dirname = dirname(fileURLToPath(import.meta.url))
}
// silence `Assertion failed: IDBStore used, but indexedDB not supported` on Node.js
global.indexedDB = function () { };
shimDom()
}