Skip to content

How to use verovio in Angular? #3562

Answered by WolfgangDrescher
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

With Angular you probably want the ESM Version of Verovio. Keep in mind, that full ESM support is currently not possible due to some limitations with Emscripten. But depending on your bundler you can get around this.

Here is the link to my Vue.js implementation: https://github.com/WolfgangDrescher/vue-verovio-canvas

Your code should look similar to this:

import createVerovioModule from 'verovio/wasm';
import { VerovioToolkit } from 'verovio/esm';

createVerovioModule().then(VerovioModule => {
    const toolkit = new VerovioToolkit(VerovioModule);
    toolkit.loadData(...);
    const svg = toolkit.renderToSVG();
});

If you use Vite as a bundler you will have to use:

export default defineCo…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by lpugin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants