简体   繁体   中英

Laravel Mix import JS return errors

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...

这是资源文件夹上的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.

Just missed that app.js load bootstrap and jquery by default, So first, removed the duplicate require that load jQuery

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

Next, Modernizr is loaded on my base layout (welcome.blade.php) on the head.

<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:

在此处输入图片说明

在此处输入图片说明

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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