简体   繁体   中英

How to add external js file into Laravel project app.js file?

I want to use this package for audio equalizing animation. I want to add it in my Laravel project so I copied two files which are

jquery.reverseorder.js
jquery.equalizer.js

to /myproject/node_modules/myjss/

and added these two lines

import 'myjss/jquery.equalizer'
import 'myjss/jquery.reverseorder'

into /myproject/resources/js/app.js

but it returns TypeError: $(...).equalizer is not a function

How can I fix it?

You don't need to save those files like that. Just save them in laravel's assets folder. then in laravel, you should include it like this <script type="text/javascript" src="js/jquery.reverseorder.js"></script> . in src path, you can use asset_path of laravel. You can include this path in js or laravel's blade template.

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