Using with webpack
tuzemec opened this issue · 7 comments
I get the following error when I try to bundle the JZZ module with latest WebPack:
It seems that it's originating from the node check here
As far as I get it, currently JZZ is not exported as ES module and it fails to do so because of the require
.
Any plans to do that?
Thanks for reporting that!
Any quick ideas how to fix it?
I've tried a couple of things, but the only thing that somewhat worked is removing the require
statement. But it's more of a hack and it will break the node usage.
I had some good experience with Rollup for bundling different type of modules out of single codebase, but this will require changing the whole toolchain of all the JZZ projects.
Maybe this article can give some directions: https://www.sensedeep.com/blog/posts/2021/how-to-create-single-source-npm-module.html
I tried this snippet with webpack 5.52.0 (Windows 10) and did not see any errors:
//var JZZ = require('jzz'); // works both ways
import * as JZZ from 'jzz'; // works both ways
JZZ().or('Cannot start MIDI engine!!!').and('MIDI engine is running!!!');
Could you please send me the instructions how to reproduce the issue?
Do you get any warnings with this project: https://github.com/tuzemec/jzz-webpack-test
Or this is just an OSX thing? :)
Thanks!
Yes, I see the warning on your project, but the resulting page works correct.
I guess you can ignore the warning for now, and I'll think how to make the webpack happy...
This might be the solution: https://medium.com/tomincode/hiding-critical-dependency-warnings-from-webpack-c76ccdb1f6c1
Thanks a lot. It works.
And I've updated the example project so it doesn't have warnings anymore.
Hope someone will find it useful.
Cheers!