Open samusaran opened 2 years ago
I was seeing a similar issue when loading bootstrap-select in an import with webpack. I get this error only on the v2 beta as well. Not sure if it's the same issue, but hopefully it helps.
It was failing on this line: var Dropdown = window.Dropdown || bootstrap.Dropdown;
in bootstrap-select.js.
I was able to work around it for the time being using the ProvidesPlugin to assign bootstrap's Dropdown directly to the window object.
webpack.config.js
new webpack.ProvidePlugin({
'window.Dropdown': ['bootstrap','Dropdown'],
})
myModule.js:
import 'bootstrap-select'
import 'bootstrap-select/dist/css/bootstrap-select.css'
same issue in beta 2 and beta 3
var Dropdown = window.Dropdown || bootstrap.Dropdown;
Uncaught ReferenceError: bootstrap is not defined
using: bootstrap-select: 1.14.0 bootstrap: 4 jQuery: 3.6.0
temporary fix by setting window.Dropdown = $.fn.dropdown
window.Dropdown = $.fn.dropdown;
doesn't seem to solve the issue.
In beta 3, we still have this issue
I'm sharing the solution that worked for me for anyone who might still be struggling.
In the file where you import bootstrap-select
, first import bootstrap
and assign it to the window object.
const bootstrap = require('bootstrap');
window.bootstrap = bootstrap;
require('bootstrap-select');
This was tested with Bootstrap v5.2.3 and Bootstrap-select v1.14.0-beta3.
Anyone found a workaround using Vite ? The solution proposed by morgan doesn't work in this context.
Hi there! I'm having problems to run bootstrap-select v1.14.0-beta3 in vite laravel. Could anyone help me with this?
I'm sharing the solution that worked for me for anyone who might still be struggling.
In the file where you import
bootstrap-select
, first importbootstrap
and assign it to the window object.const bootstrap = require('bootstrap'); window.bootstrap = bootstrap; require('bootstrap-select');
This was tested with Bootstrap v5.2.3 and Bootstrap-select v1.14.0-beta3.
Can you help to implement in vite laravel?
Hi. Any solution for laravel+vite?
I'm currently trying to use bootstrap-select in a Power BI Visual (a self contained typescript app).
I'm using:
When I try to load the app the following error occurs:
Sadly I cannot use bootstrap <5 because I can't make it compile (i always get an error on the CSS compilation, that I don't get with bootstrap 5)