I'm really fracking tired to struggle with mix thing.. really cannot understand what it is.
I just want to add a piece of script that needs to control my AJAX request. So here's what I do.
searchResource.js
on resources\\assets\\js
directory. Edit webpack.mix.js
file before to after.
// Before mix .js('resources/assets/js/app.js', 'public/js') // After mix .js([ 'resources/assets/js/app.js', 'resources/assets/js/searchConcepts.js' ], 'public/js')
On console, run npm run dev
.
After this, I got Dependency was not found
error and don't have a clue why/where do I specify dependencies for just simple script add.
After extensive search, I think there is something more has to be done but don't know what it is. Further, I believe I can't handle this. Need help..
Obviously, there is a reason why I can't mix things all together in app.js, but still don't know why. However, I've manage to do this anyway.
First, I should use .scripts()
method and save my custom script to something like all.js
, not app.js
.
So, here is my answer.
mix
.scripts('/resources/assets/js/ajaxAdaptor.js')
.js('.. ')
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.