mix.scripts无法正常工作(webpack.mix.js) [英] mix.scripts is not working (webpack.mix.js)

查看:120
本文介绍了mix.scripts无法正常工作(webpack.mix.js)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下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');

,当我运行npm run dev时,出现此错误: 带有宅基ssh的cmd中的错误

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

推荐答案

我遇到了同样的问题,您应该尝试使用mix.combine而不是mix.scripts. 因此,脚本的第一部分应变为:

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');

我在这里找到了解决方案: https ://github.com/JeffreyWay/laravel-mix/blob/master/docs/concatenation-and-minification.md

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

这篇关于mix.scripts无法正常工作(webpack.mix.js)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆