Home > OS >  Laravel Mix Error Using version() and copyDirectory()
Laravel Mix Error Using version() and copyDirectory()

Time:03-08

I am having a problem using copyDirectory() with version() on laravel mix.

let mix = require('laravel-mix'),

mix.copyDirectory('node_modules/bootstrap', 'public/vendor/bootstrap')
.sass('resources/assets/sass/style.scss', 'public/css')
.version();

Is there any other way to do this?

CodePudding user response:

let mix = require('laravel-mix'),

mix.setPublicPath(path.resolve('./'))
    .copyDirectory('node_modules/bootstrap', 'public/vendor/bootstrap')
    .sass('resources/assets/sass/style.scss', 'public/css')
    .version();

This should resolve the issues, if not I am unsure on what it could be. maybe your mix manifest

CodePudding user response:

The code below worked as expected now.

let mix = require('laravel-mix'),

mix.copyDirectory('node_modules/bootstrap', 'public/vendor/bootstrap')
.sass('resources/assets/sass/style.scss', 'public/css')
.version();

It turned out that the one of the copyDirectory entry is causing the problem, which is:

.copyDirectory('node_modules/chart.js', 'public/vendor/chart.js')

So, I just converted it to .copy() and I just copied the js and css file for the chart.js.

Everything worked as expected after that.

  • Related