简体   繁体   English

mix.scripts无法正常工作(webpack.mix.js)

[英]mix.scripts is not working (webpack.mix.js)

i have the following webpack.mix.js: 我有以下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 当我运行npm run dev以下错误: 带有宅基ssh的cmd中的错误

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. 为我工作。

I had the same issue, you should try to use mix.combine instead of mix.scripts. 我有同样的问题,您应该尝试使用mix.combine而不是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 我在这里找到了解决方案: https : //github.com/JeffreyWay/laravel-mix/blob/master/docs/concatenation-and-minification.md

我解决了问题的使用

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 webpack.mix 编译 js 文件时,mix.scripts 在 laravel 5.5 上不起作用 - mix.scripts doesn't work on laravel 5.5 while compiling js files using webpack.mix Laravel Mix 'watch' 在 webpack.mix.js 更新时无法编译 - Laravel Mix 'watch' not compiling when webpack.mix.js updated 如何在Laravel webpack.mix.js中添加全局函数? - How to add global functions in Laravel webpack.mix.js? webpack.config.js 和 Webpack.mix.js 有什么区别? - What is the difference between webpack.config.js And Webpack.mix.js? 为什么在构建 webpack.mix.js 时我的.css 文件不会出现在公共目录中? - Why won't my .css file show up in the public directory when building webpack.mix.js? Laravel使用mix.scripts()压缩javascript; 重命名压缩文件中的函数 - Laravel compressing javascript using mix.scripts(); renames function in compressed file 为什么我的 SCSS 无法加载,即使它位于我使用 React.js 搭建的 Laravel 项目中的 webpack.mix.js 中? - Why won't my SCSS load even though it's in the webpack.mix.js in my Laravel project that's scaffolded with React.js? Laravel,webpack.mix中的js,未找到功能 - Laravel, js in webpack.mix, function not found Laravel Mix / Webpack不会在通过babel()编译的脚本上触发监视功能 - Laravel mix / webpack not triggering the watch functionality on scripts compiling through babel() 尝试使用 Laravel mix / webpack 时出现 JS 错误 - JS errors when trying to use Laravel mix / webpack
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM