grimmdude / MidiPlayerJS

♬ MIDI parser & player engine for browser or Node. As a parser converts MIDI events into JSON. Works well with single or multitrack MIDI files.
https://grimmdude.com/MidiPlayerJS/
MIT License
357 stars 52 forks source link

Add es module build for browser installation #70

Closed acmiyaguchi closed 3 years ago

acmiyaguchi commented 3 years ago

Thanks for this great package! I've had fun using it so far, and it's one of the few packages in the ecosystem that fits my needs.

I'm using a browser bundler for my application, so the current set of builds are problematic. When I use npm install midi-player-js for my web app, it also includes the require("fs") statement in loadFile. I did a couple things to resolve this:

I also removed the build directory from check ins. I left the browser directory alone, in case the github raw link was being used to source the script.

This works as expected in a small test page I made.

grimmdude commented 3 years ago

Wow thanks @acmiyaguchi! This all looks great, truly appreciate your contribution. I know that require('fs') has been a thorn in some people's sides for a while.

Agree that docs should be handled differently so they're not always mixed up with code changes.

vinzentt commented 3 years ago

I'm still having he issue with fs module not found because this PR was merged to master without a release. Do you know when the next release is planned?

grimmdude commented 3 years ago

Hey @vinzentt, thanks for the reminder. I just published 2.0.14 to npm which includes this change.