Laravel Mix Download
This extension provides Download support to your Mix (v2.1 and up) builds. This allows you to download external files.
Usage
First, install the extension.
npm install laravel-mix-dl --save-dev
Then, require it within your webpack.mix.js
file, like so:
let mix = require('laravel-mix');
require('laravel-mix-dl');
mix
.js('resources/assets/js/app.js', 'public/js')
.less('resources/assets/less/app.less', 'public/css')
.download([
{
url: 'https://google-analytics.com/analytics.js',
filepath: 'js/analytics.js',
},
]);
And you're done! Compile everything down with npm run dev
.