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

痞子三分冷 提交于 2020-01-24 19:37:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!