Run jitsi-meet locally: "$ is not defined"

I’m trying to run jitsi-meet locally using “make dev”.
Unfortunately, I get this:

2020-04-24T19:50:42.793Z [features/base/connection] ReferenceError: $ is not defined
    at new t (xmpp.js:121)
    at new c (JitsiConnection.js:24)
    at connect (connection.js:96)
    at openConnection (connection.js:198)
    at connect (conference.js:173)
    at Object.createInitialLocalTracksAndConnect (conference.js:609)
    at conference.js:660

I got a similar error earlier. It disappeared by adding to the webpack.js file:

var webpack = require("webpack");

and later:

plugins: [
        analyzeBundle
            && new BundleAnalyzerPlugin({
                analyzerMode: 'disabled',
                generateStatsFile: true
            }),
        new webpack.ProvidePlugin({
            $: "jquery",  
            jQuery: "jquery"
        })

But again the ‘' is not defined. I bet the first '’ was in jitsi-meet, the second is in lib-jitsi-meet?

I also needed to copy lib-jitsi-meet-min.js to lib-jitsi-meet.js in the libs/ folder.

Any ideas? Thanks in advance!

3 Likes

Hi! I had the same issue and solved it in 2 steps:

  1. In webpack.config.js replace

    {
    loader: 'expose-loader?!expose-loader?jQuery', test: /\/node_modules\/jquery\/.*\.js/
    }

with

{
    test: require.resolve('jquery'),
    use: [ {
        loader: 'expose-loader',
        options: 'jQuery'
    }, {
        loader: 'expose-loader',
        options: '$'
    } ]
}
  1. removed the alias in resolve section, because it wasn’t allowing expose-loader to find ‘jquery’:
    alias: {
    jquery: jquery/dist/jquery${minimize ? '.min' : ''}.js
    },

Thank you very much!