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.
- I create custom file
searchResource.js
onresources\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 likeall.js
, notapp.js
.So, here is my answer.