Help us understand the problem. What is going on with this article?

Laravelでbootstrap4をwebpackでまとめる

More than 3 years have passed since last update.

bootstarp4ではTetherを使っており、以下のようなエラーが出る。

Uncaught Error: Bootstrap tooltips require Tether

Tetherをnpmでインストール

$ npm install tether -S

webpack.mix.jsを修正

以下を追加する。

webpack.mix.js
/**
 * Add tether for bootstrap4
 */
mix.autoload({
    tether: ['Tether', 'window.Tether']
});

結果、webpack.mix.jsはこんな感じに

webpack.mix.js
const { mix } = require('laravel-mix');

/**
 * Add tether for bootstrap4
 */
mix.autoload({
    tether: ['Tether', 'window.Tether']
});

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.react('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css')
   .version();

GitHubのissueではjqueryも読み込ませてますが、とりあえずこれがなくてもコンソールエラーは起きませんでした。もしかしたら必要なのかもしれません・・・
https://github.com/JeffreyWay/laravel-mix/issues/584#issuecomment-287445207

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした