I'm having trouble initializing bootstrap-multiselect. I am using NPM, webpack and have made sure bootstrap-multiselect is loaded after jquery and bootstrap:
import $ from 'jquery';
window.jQuery = $;
window.$ = $;
import Rails from 'rails-ujs';
import Turbolinks from 'turbolinks';
Rails.start();
Turbolinks.start();
import 'bootstrap/dist/js/bootstrap';
import 'bootstrap-multiselect/dist/js/bootstrap-multiselect';
Would anyone have any thoughts?
Sorry, not a problem relating to this library
@echan00 Can you please tell us how you solved the issue? Did you add something to webpack.config.js
?
Hmm I don't remember anymore. Make sure your jquery and bootstrap versions are up to date?
I'm facing the same problem. I am using Rails6 + Webpacker. I was able to work around the problem by doing the following, but is there any other better way?
} else {
// Browser globals
- factory(root.jQuery, root.ko);
+ factory(window.jQuery, root.ko);
}
}
})(this, function ($, ko) {
It seems that root
is being passed this
, but via webpack(er), it is an empty object.
It works fine.
imports-loader + wrapper option:
wrapper: 'window',
https://github.com/davidstutz/bootstrap-multiselect/issues/1123#issuecomment-731151754
Is this a problem with bootstrap-multiselect being legacy?