Dev Notes

Software Development Resources by David Egan.

Using Bootstrap 4 & Laravel Mix - Autoload Tether

Bootstrap 4, Laravel, Mix, Webpack
David Egan

If you are using Bootstrap 4 with Laravel 5.4, you may encounter a problem related to Tether.

Bootstrap 4 requires Tether. Running the default Laravel mix webpack config throws an error because the Tether module is not available as a variable in the Bootstrap module. You might get a Console error like this:

Uncaught Error: Bootstrap tooltips require Tether (
    at app.f3e519c….js:14883
    at app.f3e519c….js:15484
    at Object.<anonymous> (app.f3e519c….js:15669)
    at Object.VERSION (app.f3e519c….js:15671)
    at __webpack_require__ (app.f3e519c….js:20)
    at Object.<anonymous> (app.f3e519c….js:12095)
    at Object.<anonymous> (app.f3e519c….js:12129)
    at __webpack_require__ (app.f3e519c….js:20)
    at Object.<anonymous> (app.f3e519c….js:11192)
    at __webpack_require__ (app.f3e519c….js:20)

Fortunately there’s a pretty easy fix.


Laravel mix has an autoload() method that requires modules wherever they are needed.

To fix the Tether issue, add this to webpack.mix.js:

    tether: ['Tether', 'window.Tether']

This requires tether wherever either the variable Tether or window.Tether is referenced (in this case, by Bootstrap). I think Bootstrap 4 uses the latter.


comments powered by Disqus