Ask questionsOptimize for npm install
Apologies if this has been discussed already, but I can't find any other conversations on this topic.
Is there a reason that this package isn't really optimized for being installed through npm? I'm trying to integrate this into a React app and I'm having a bit of a hard time getting everything up and running.
It would be nice if we could simply
npm install lib-jitsi-meet within a project and then just
import JitsiMeetJS from 'lib-jitsi-meet';, however this currently doesn't seem to be possible.
Obviously the package isn't currently published to npm, but that's not an issue as we can install directly from this repo. Doing that, however, seems to do three things. It...
postinstallnpm script (
webpack -p) and fails because of missing devDependencies.
<my-react-project>/node_modules/lib-jitsi-meet and running
npm install manually does install these devDependencies and run the
postinstall script successfully, creating
At this point, trying to
import JitsiMeetJS from 'lib-jitsi-meet'; creates errors as the
"main" property of the
package.json references the
./index.js file, rather than the built (and transpiled)
lib-jitsi-meet.min.js file created by webpack.
If we update the
"main" property of the
package.json to be
import JitsiMeetJS from 'lib-jitsi-meet'; does in fact import
JitsiMeetJS as expected. Now, however, we get a
ReferenceError: Strophe is not defined.
import strophe; does resolve this, however we then get
Missing strophe-plugins (disco and caps plugins are required)!. At this point it's clear that the strophe and strophe-plugins modules aren't included in the
lib-jitsi-meet.min.js file that webpack builds, even though they are listed as project dependencies. Is there a reason that the choice was made to require these modules globally, rather than just importing them whenever they're needed? From looking through the codebase it looks like the same goes for jQuery.
This all can be solved by the user including
<script> tags in their html, as you recommend, or possibly by using webpack's
ProvidePlugin, but it seems like it would be far nicer to try to do as much as possible when packaging the module in the first place.
Interested to hear your thoughts on this.
Answer questions sapkra
you can do a 'npm install lib-jitsi-meet' and use it as a module
This version is extremely old and has some bugs. Like @saghul mentioned here we have to use the GitHub version.
The problem with the GitHub version is that the build is failing when you try to install it because
string-replace-loader cannot be resolved so we have to install it manually.
I would appreciate it when there will be an official version published on npm.
The experience to install this library was really bad and there is much room for improvements.