Topic: How to integrate webpack to laravel?

Mario Otmacic pro asked 6 years ago


Is it possible and how to do it? or it is better to import everything (mdbpro) into a package and mix?

Marta Wierzbicka staff answered 6 years ago


Hi, Have you already solved your problem? Best, Marta

Mario Otmacic pro commented 6 years ago

No. It is still not working. Do you know where is problem?

Anna Morawska staff commented 6 years ago

Hi there, Unfortunately, MDB was not tested using Laravel Mix. As you can imagine, we cannot guarantee support for all the technologies out there. Do not hesitate to share your implementation experience here, so it can help someone out there

Mario Otmacic pro answered 6 years ago


<!-- MDB -->
<script type="text/javascript" src="{{asset('mdbo/js/jquery-3.3.1.min.js')}}"></script>
  <script type="text/javascript" src="{{asset('mdbo/js/popper.min.js')}}"></script>
  <script type="text/javascript" src="{{asset('mdbo/js/bootstrap.min.js')}}"></script>
  <script type="text/javascript" src="{{asset('mdbo/js/mdb.js')}}"></script>

Mario Otmacic pro answered 6 years ago


Hi, I use laravel mix to load all mdb assets like this: //Mix JS mix.scripts(['resources/assets/mdb/js/jquery-3.3.1.min.js', 'resources/assets/mdb/js/popper.min.js', 'resources/assets/mdb/js/bootstrap.min.js', 'resources/assets/mdb/js/mdb.min.js'], 'public/js/app.js').sourceMaps(); and webpack compiled successfully. But when i refresh browser  in console log appears this error: Uncaught ReferenceError: jQuery is not defined at Object.eval (mdb.min.js?7f32:1) at eval (9:8275) at Object.<anonymous> (app.js:130) at __webpack_require__ (app.js:20) at Object.<anonymous> (app.js:98) at __webpack_require__ (app.js:20) at app.js:63 at app.js:66   This is error in mdb.min.js: var WOW;jQuery.easing.jswing=jQuery.easing.swing,jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(t,e,i,n,o){..........   Do you know how to resolve this? Thank you!      

Mario Otmacic pro commented 6 years ago

but when i add scripts in html: it's working fine!

Marta Wierzbicka staff answered 6 years ago


Hi, we don't have a tutorial yet but many customers succeeded in using webpack, mdb can loaded like any other 3rd party libs. Maybe this tutorial will be helpful for you in some way: https://mdbootstrap.com/support/mdb-webpack-guide/. Best, Marta

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags