问题
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
回答1:
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
回答2:
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.
回答3:
I solved the problem use
mix.js('resources/js/app.js', 'public/js')
来源:https://stackoverflow.com/questions/42574999/mix-scripts-is-not-working-webpack-mix-js