tambien/Piano

No matching export in "node_modules/webmidi/dist/esm/webmidi.esm.min.js" for import "default"

intergalacticspacehighway opened this issue ยท 2 comments

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

I had been getting an error with Webmidi import, I had to do the below change to fix it. I can create a PR for the same :)

WebMidi is being exported as named export in webmidi 3.0.15

Here is the diff that solved my problem:

diff --git a/node_modules/@tonejs/piano/build/midi/MidiInput.js b/node_modules/@tonejs/piano/build/midi/MidiInput.js
index 7c5a066..ab69ffa 100644
--- a/node_modules/@tonejs/piano/build/midi/MidiInput.js
+++ b/node_modules/@tonejs/piano/build/midi/MidiInput.js
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
     });
 };
 import { EventEmitter } from 'events';
-import WebMidi from 'webmidi';
+import {WebMidi} from 'webmidi';
 export class MidiInput extends EventEmitter {
     constructor(deviceId = 'all') {
         super();

This issue body was partially generated by patch-package.

I stumbled into this. I had to downgrade to webmidi@2 for it to work without monkey-patching.

It looks like, if you don't need the MidiInput, the simplest solution is:

import { Piano } from "@tonejs/piano/build/piano/Piano";