npm install filemanager-webpack-plugin --save-dev
# or
yarn add filemanager-webpack-plugin --dev
// webpack.config.js:
// vue.config.js
const FileManagerPlugin = require('filemanager-webpack-plugin');
module.exports = {
plugins: [
new FileManagerPlugin({
events: {
onEnd: {
copy: [
{ source: '/path/fromfile.txt', destination: '/path/tofile.txt' },
{ source: '/path/**/*.js', destination: '/path' },
],
move: [
{ source: '/path/from', destination: '/path/to' },
{ source: '/path/fromfile.txt', destination: '/path/tofile.txt' },
],
delete: ['/path/to/file.txt', '/path/to/directory/'],
mkdir: ['/path/to/directory/', '/another/directory/'],
archive: [
{ source: '/path/from', destination: '/path/to.zip' },
{ source: '/path/**/*.js', destination: '/path/to.zip' },
{ source: '/path/fromfile.txt', destination: '/path/to.zip' },
{ source: '/path/fromfile.txt', destination: '/path/to.zip', format: 'tar' },
{
source: '/path/fromfile.txt',
destination: '/path/to.tar.gz',
format: 'tar',
options: {
gzip: true,
gzipOptions: {
level: 1,
},
globOptions: {
nomount: true,
},
},
},
],
},
},
}),
],
};
网友评论