LaravelLaravel MixWebpack

Laravel Mix: How to output separate files rather than a combined one?

By April 27, 2018 No Comments

Update the path as per your setup. Following is tested on Laravel 5.6.

1
2
3
4
5
6
var fs = require('fs');
var vueFiles = fs.readdirSync('resources/assets/frontend/js/vue');

for(var i = 0; i < vueFiles.length; i++){
mix.js('resources/assets/frontend/js/vue/'+vueFiles[i], 'public/assets/frontend/js/output_vue/output_'+ vueFiles[i]);
}