tambien / Piano

Multisampled Piano implementation using Salamander Grand Piano Sounds
https://tambien.github.io/Piano
MIT License
184 stars 48 forks source link

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

Open intergalacticspacehighway opened 2 years ago

intergalacticspacehighway commented 2 years ago

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.

gabrielmontagne commented 2 years ago

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

dmitry-guryev commented 1 year ago

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

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