Closed plh97 closed 6 years ago
I'm trying to build your player for the browser using Webpack. I'm seeing the same thing. The error is:
ERROR in ./~/midi-player-js/module/index.js Module not found: Error: Can't resolve 'fs' in path.......
My code is simple - it doesn't do anything yet only require packages. See below:
var PlayMidi = (function() {
var Soundfont = require('soundfont-player')
var MidiPlayer = require('midi-player-js');
var loadFile, loadDataUri, Player;
var AudioContext = window.AudioContext || window.webkitAudioContext || false;
var ac = new AudioContext || new webkitAudioContext;
})();
module.exports = PlayMidi;
Hope that helps!
Hi @allan-farrell,
Thanks for your message. I see what's going on, will work on a solution for this. In the meantime can you try this fix and let me know if it helps?
https://github.com/webpack-contrib/css-loader/issues/447#issuecomment-285598881
-Garrett
LoL! I just discovered that fix myself about 5 min ago - it does work!
Great lib, by the way.
Thanks.
Awesome! Thx
Hi @pengliheng,
Thanks for your message. Could you please show an example of the code you're using which generates this error? The only function in this player which uses the
fs
module isPlayer.loadFile()
. Are you using this in node or browser? Thanks,-Garrett