Support the ongoing development of Laravel.io →
posted 7 years ago

i have a function in my resource/js/app.js like:

  function notifme(text) {
       alert(text);
  }

i am using webpack.. after compiling with npm run dev..

when i'm calling this in my template/body

   $(document).ready(function(){
        notifme('alert');
   });

it's not working. and there is some file like

  (function(module, exports) {....

in my js file. i think webpack add extra to my compiled file.. because if i add the main function separately or right before my calling script tag in html, it's working..!!!!

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Behzad.A Behzad.A behzad Joined 23 Jun 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.