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...

  1. Clones the repo
  2. Installs production dependencies only, not devDependencies
  3. Runs postinstall npm script (webpack -p) and fails because of missing devDependencies.

Navigating to <my-react-project>/node_modules/lib-jitsi-meet and running npm install manually does install these devDependencies and run the postinstall script successfully, creating lib-jitsi-meet.min.js and

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 ./lib-jitsi-meet.min.js then import JitsiMeetJS from 'lib-jitsi-meet'; does in fact import JitsiMeetJS as expected. Now, however, we get a ReferenceError: Strophe is not defined.

Adding 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 @babel/plugin-proposal-export-namespace-from and 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.

Paul Tiedtke sapkra @lynoapp Düsseldorf, Germany Working on the clubhouse for remote teams @lynoapp
Github User Rank List