Created
March 16, 2022 04:10
-
-
Save orionstar/7588719d8f4e7481077f209fe1ff2df4 to your computer and use it in GitHub Desktop.
Laravel Mix - Copy outside the public path & use version() with the other files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mix = require('laravel-mix') | |
const CopyWebpackPlugin = require('copy-webpack-plugin') | |
/** | |
* Mix doesn't support copy content outside the public path AND simultaneously using version() | |
*/ | |
class CopyOutside { | |
tasks = []; | |
name() { | |
return 'copyOutside'; | |
} | |
dependencies() { | |
return [ | |
'copy-webpack-plugin' | |
]; | |
} | |
register(from, to) { | |
this.tasks.push({ | |
from: from, | |
to: to | |
}); | |
} | |
webpackPlugins() { | |
return [new CopyWebpackPlugin({ | |
patterns: this.tasks, | |
})]; | |
} | |
} | |
mix.extend('copyOutside', new CopyOutside()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment