M.abdelrhman
M.abdelrhman

Reputation: 1088

mix.scripts doesn't work on laravel 5.5 while compiling js files using webpack.mix

I am using Laravel 5.5 , in webpack.mix file the mix.styles function works perfectly and i compile my css files perfectly but mix.scripts doesn't compile the js files i found in the documentation that mix.babel Its method signature is identical to scripts.mix so i used it but nothing changed

this is my webpack.mix.js file

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

Upvotes: 1

Views: 562

Answers (1)

M.abdelrhman
M.abdelrhman

Reputation: 1088

There was no problem with the webpack.mix file the mix.babel works perfectly ,the problem was that i am using Ubuntu and when libs.js file was created it was read only by default and it was preventing the compiling so i had to change it to read and write chmod.

Upvotes: 1

Related Questions