简体   繁体   English

Laravel Mix导入JS返回错误

[英]Laravel Mix import JS return errors

Laravel 5.4, NPM 5.8.0 Laravel 5.4,NPM 5.8.0

After compile the assets I'm getting this error on every js library that is loaded on before bootstrap.js... 编译资产后,我在bootstrap.js之前加载的每个js库上都收到此错误...

这是资源文件夹上的app.js

执行npm后,运行dev在控制台上收到此错误

然后将所有内容移至bootstrap lib的上方

现在不是modernizr错误,是jQuery滚动条

What type of thing I'm missing? 我缺少什么类型的东西? I have no modified any core of laravel, Just add the JS libs and compile with npm run dev. 我没有修改laravel的任何核心,只需添加JS库并使用npm run dev进行编译。

Just missed that app.js load bootstrap and jquery by default, So first, removed the duplicate require that load jQuery 只是错过了默认情况下app.js加载bootstrap和jquery,所以首先,删除重复项要求加载jQuery

//require('./jobhunt/jquery.min');

Next, Modernizr is loaded on my base layout (welcome.blade.php) on the head. 接下来,将Modernizr加载到我的基本布局(welcome.blade.php)的头部。

<script type="text/javascript" src="{{ asset('/js/jobhunt/modernizr.js') }}"></script>

Last, I've detected that my template has deprecated or older versions of jQuery.scrollbar, waypoints, and jQuery counterUp, So I upgraded and now this is the result: 最后,我检测到我的模板已弃用或更旧版本的jQuery.scrollbar,路标和jQuery counterUp,所以我进行了升级,现在是这样的结果:

在此处输入图片说明

在此处输入图片说明

So, I think that is because the theme has old libs and I think that is important leave the bootstrap on top of any require lib. 因此,我认为这是因为该主题具有较旧的库,并且我认为将引导程序置于所有需要的库之上很重要。 Now my console is clean of errors. 现在,我的控制台已清除错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM