Support the ongoing development of Laravel.io →
Configuration Views
Last updated 2 years ago.
0

Hi, Don't know if this will help you but I ran into similar problems when trying to use some plugins that depend on jQuery. What I think is you need to tell Webpack that there will be an alias 'jquery' so when other plugins refer to it, webpack knows where to grab it.

I solved it recently by adding to my webpack config file the following (I've shortened my webpack config just for what's important in this case):

var webpack = require("webpack");
var path = require("path");
module.exports = {
    resolve: {
        alias: {
            // Force all modules to use the same jquery version.
            'jquery': path.join(__dirname, 'node_modules/jquery/src/jquery')
        }
    }
};

Then in your bootstrap.js file you require your plugins, I needed the bootstrap datetimepicker so this is what I needed to do:

window.$ = window.jQuery = require('jquery');
window.moment = require('moment');
require('bootstrap-sass');
require('datetimepicker');

I'm not a webpack power user yet so it took me couple of hours to get it working, but I did!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

tugi tugi Joined 31 Oct 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.