我正在使用Laravel 5.3
,
我想打包文件app.js
中的所有javascript文件,我需要()tether
和cropper
,如下所示:
:
require('tether');// `tether` is put at the head of `Bootstrap`
require('./bootstrap');
require('cropper');
Vue.component('example', require('./components/Example.vue'));
const app = new Vue({
el: 'body'
});
然后运行gulp
,没关系!
但在chrome broswer的控制台中,有2个错误:
Uncaught Error: Bootstrap tooltips require Tether
Uncaught TypeError: $image.cropper is not a function
为什么?
PS:
bootstrap
不是Bootstrap
,bootstrap.js
中有resources/assets/js
个文件,而Bootstrap
是Twitter的用户界面。
答案 0 :(得分:1)
因此,正如我在评论中所写,解决方案是遵循以下代码:
import Tether from 'tether'
window.Tether = Tether;