Laravel Elixir and Bootstrap's JS

Laravel Elixir and Bootstrap's JS

本文关键字:JS Elixir and Bootstrap Laravel      更新时间:2023-09-26

我使用ES6语法将内容导入到我的app.js浏览器文件中,如下所示:

import $ from 'jquery';
import Bootstrap from 'bootstrap-sass';

仍然,我得到以下错误:

bundle.js:3 Uncaught Error: Bootstrap's JavaScript requires jQuery

当我检查bundle.js文件时,Bootstrap JS和jQuery都在那里,但顺序不同(Bootstrap总是先来)。我试着在加载时切换它们,但结果仍然相同。

任何想法?

您必须先加载jquery库,然后加载bootstrap库。还要检查您是否使用了最新的jquery库。

如果仍然有相同的错误:那么可能是conflict与其他jQuery库。