Ian Farré
Ian Farré

Reputation: 23

mix.scripts is not working (webpack.mix.js)

i have the following webpack.mix.js:

const { mix } = require('laravel-mix');
mix.scripts([
    'resources/assets/js/app.js',
    'resources/assets/js/definers.js',
    'resources/assets/js/tab_system.js',
    'resources/assets/js/searchbox.js',
    'node_modules/angular/angular.js',
], 'public/js/app.js', 'public/js');

mix.js('resources/assets/js/afegir_caracteristica_visuals.js', 'public/js')
    .js('resources/assets/js/afegir_categoria_visuals.js', 'public/js')
    .js('resources/assets/js/afegir_localitat_visuals.js', 'public/js')
    .js('resources/assets/js/afegir_tipo_visuals.js', 'public/js')
    .js('resources/assets/js/afegir_transaccio_visuals.js', 'public/js')
    .js('resources/assets/js/eliminar_element.js', 'public/js');

mix.styles([
    'resources/assets/css/tab_system.css',
    'resources/assets/sass/app.scss',
], 'public/css/app.css');

and when i run npm run dev i get this error: error in the cmd with the homestead ssh

Upvotes: 2

Views: 13249

Answers (3)

F00x
F00x

Reputation: 124

I solved the problem use

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

Upvotes: 0

Volmarg Reiso
Volmarg Reiso

Reputation: 483

Well that might be a bit old topic but I was looking for solution on my own so:

npm update laravel-mix 

and

npm install cross-env

worked for me.

Upvotes: 3

Sebastien
Sebastien

Reputation: 625

I had the same issue, you should try to use mix.combine instead of mix.scripts. So the first part of your script should become:

mix.combine([
    'resources/assets/js/app.js',
    'resources/assets/js/definers.js',
    'resources/assets/js/tab_system.js',
    'resources/assets/js/searchbox.js',
    'node_modules/angular/angular.js',
], 'public/js/app.js', 'public/js');

I found the solution here: https://github.com/JeffreyWay/laravel-mix/blob/master/docs/concatenation-and-minification.md

Upvotes: 3

Related Questions