Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The requested module does not provide an export named 'default' #146

Closed
michaelcaterisano opened this issue May 29, 2021 · 7 comments
Closed
Assignees
Labels
Type: enhancement Request for improvement

Comments

@michaelcaterisano
Copy link

michaelcaterisano commented May 29, 2021

I'm trying out webmidi 2.5.2 in a typescript environment and am getting an error when importing webmidi like this: import Webmidi from "webmidi";.

The requested module does not provide an export named 'default'

I also tried import * as WebMidi from "webmidi", but then I get the following error:

Uncaught TypeError: Cannot read property 'WebMidi' of undefined
    at webmidi.min.js:31
    at webmidi.min.js:31
@djipco djipco self-assigned this Jun 1, 2021
@djipco djipco added the Type: enhancement Request for improvement label Jun 1, 2021
@djipco
Copy link
Owner

djipco commented Jun 1, 2021

Unfortunately, I am not a TypeScript user and know very little about it. For that reason, WebMidi.js does not officially support TypeScript yet. I am looking to change that for version 3 but will need a knowledgeable TypeScript dev to work on the type definitions.

At one point, users have reported that it was working (as you saw in issue #82) . I'm not sure why it isn't working for you.

For personal bandwidth reasons, official TypeScript support will not come before version 3 (unless someone chimes in to help).

@michaelcaterisano
Copy link
Author

Thanks @djipco. I did get the following syntax to work, which I found in the Tone.js/ui library:

const WebMidi: import("webmidi").WebMidi = require("webmidi");

A little funky, but it works!

@djipco
Copy link
Owner

djipco commented Jun 6, 2021

@michaelcaterisano Thank you so much for taking the time to report back. It will probably be helpful to others. I added your technique to the README.

@djipco djipco closed this as completed Jun 6, 2021
@djipco
Copy link
Owner

djipco commented Aug 26, 2021

I tentatively added a types directory with d.ts files for all current classes (this is what the TypeScript compiler outputted). Is the usual practice to have a single index.d.ts file? In any case, if you want to give it go, be my guest!

By the way, this is in the develop branch for v3.

@edellaq
Copy link

edellaq commented Aug 26, 2021

Trying to interface a simple SPA application to my Fishman TriplePlay Controller. Using v.2.5.2
I'm able to read the played notes, I'm having some trouble with sysex management.

  1. is the WebMidi.enable(...,true) necessary only once, or should it be issued (without 'true' parameter) again after sending the data initialisation array, when adding the event listeners?

  2. Fishman doesn't provide support about sysex messages, and I'm trying to intercept the midi data with a MIDI monitor, but I'm unable to let it work. In particular I have to switch the controller from poly to mono mode (1 channel per guitar string), but it works only after I launch the proprietary sw, so I think I'm doing something wrong...
    Can someone post a complete example of a sysex communication?

@djipco
Copy link
Owner

djipco commented Aug 26, 2021

@edellaq Since your question is not related to this thread, would you mind opening a new thread or, better yet, post it on the forum?

@edellaq
Copy link

edellaq commented Aug 26, 2021

oops, sorry, will do.
(I clicked on the link in the email notification, didn't notice the wrong thread)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: enhancement Request for improvement
Projects
None yet
Development

No branches or pull requests

3 participants