2

I have a web app with laravel and vuejs. I use laravel-mix and in my webpack.mix.js I have:

mix.js('resources/assets/js/app.js', 'public/js') 

In the view I have

<script src="{{mix('js/app.js')}}"></script> 

But it still does not run, I think it could be interfered by <base href="{{asset('')}}"> card.

I run npm run watch but still no error message. In my website app.js can run but the other libraries get lost.

1 Answer 1

3

I always do these steps and it works please try these:

1)install laravel mix npm i

2)in webpack :

 mix.js('resources/assets/js/app.js', 'public/js'); mix.js('resources/assets/js/admin.js', 'public/js') .sass('resources/assets/sass/app.scss', 'public/css') .sass('resources/assets/sass/admin.scss', 'public/css'); 

please include your css and javascript files in new files like here in admin.js and admin.scss

3)in admin.scss include your css files for example :

@import "files/sweetalert.css"; 

4)in admin.js include your js files for example :

mix.combine([ 'files/jquery.js', ]); 

5)in blade include js and css files:

<script src='js/admin.js'"></script> <link rel="stylesheet" href="css/admin.css"> 

6)run npm run watch

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.