我正在使用Laravel 5.5
,在webpack.mix
文件中,mix.styles函数运行正常,我完全编译css
文件,但mix.scripts
不编译js文件我在文档中发现mix.babel
它的方法签名与scripts.mix相同所以我使用它但没有改变
这是我的webpack.mix.js文件
let mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');
mix.styles([
'resources/assets/css/libs/blog-post.css',
'resources/assets/css/libs/bootstrap.css',
'resources/assets/css/libs/font-awesome.css',
'resources/assets/css/libs/metisMenu.css',
'resources/assets/css/libs/sb-admin-2.css',
'resources/assets/css/libs/test.css'
], 'public/css/libs.css');
mix.babel([
'resources/assets/js/libs/jquery.js',
'resources/assets/js/libs/bootstrap.js',
'resources/assets/js/libs/metisMenu.js',
'resources/assets/js/sb-admin-2.js',
'resources/assets/js/libs/scripts.js',
'resources/assets/js/libs/test.js'
], 'public/js/libs.js');
答案 0 :(得分:1)
webpack.mix
文件没有问题,mix.babel工作得很好,问题是我使用的是Ubuntu
,当libs.js
文件被创建时,它只是默认读取它阻止了编译,所以我不得不改变它来读写chmod。