Summer Sale! All accounts are 50% off this week.

YuriAlmeida's avatar

Add Js dependencies to mix

Hi, i'm using laravel mix and want to know what is the proper way to add a js dependencie! What i did:

  • added jspdf in package.json
  • added 'node_modules/dist/jspdf.min.js' (...'public/assets/app/js/app.js').version();)
  • ran npm run dev

But my js function break when i try to -> var doc = new jsPDF() -> "jsPDF is not defined can someone what am i missing?

0 likes
1 reply
ejdelmonico's avatar

You can do it however you feel is easiest. You can just include the file using scripts() or you add a resolve value or autoload to webpack config.

A tip: don't use already minified assets for Mix, things tend to break when minification happens a second time.

1 like

Please or to participate in this conversation.