gregnb / filemanager-webpack-plugin

Copy, move, archive (zip/tar/tar.gz), delete files and directories before and after Webpack builds. Win32/Mac/*Nix supported
MIT License
463 stars 34 forks source link

How to package dist to realize dual directory #115

Closed xqhmz closed 1 year ago

xqhmz commented 2 years ago

How to package dist to realize dual directory example: dist.zip/dist/css

image

sibiraj-s commented 2 years ago

Can you elaborate? I couldn't understand whats needed.

sibiraj-s commented 2 years ago

Screenshots are not helpful. Please describe with some detail.

daoxincc commented 2 years ago

Maybe he means that he wants to remove the dist directory from the zip package and only package the dist subdirectory

xqhmz commented 2 years ago

Maybe he means that he wants to remove the dist directory from the zip package and only package the dist subdirectory

On the contrary,I hope package the dist directory and the dist subdirectory,now it dose not has the dist directory only has the dist subdirectory

const FileManagerPlugin = require('filemanager-webpack-plugin');
const path = require("path");

module.exports = {
   configureWebpack:{
       resolve:{
          extensions:['.js', '.json', '.vue', '.scss', '.css'],
          alias: {
              "@": path.resolve(__dirname, "./src"),
              "@c": path.resolve(__dirname, "./src/common")
          }
       }
       plugins:[
          new FileManagerPlugin({
             onEnd:{
                delete:["./dist.zip"],
                archive:[{source: "./dist", destination: "./dist.zip"}]
             }
          })
       ]
   }
}
daoxincc commented 2 years ago

cool, it works

daoxincc commented 2 years ago

I think that's his want.thanks

sibiraj-s commented 2 years ago

Ah. That was the intended behaviour. If you want source directory to be a part of the output archive as well. then you could move it into another directory and zip that.

parkerisme commented 2 years ago

Ah.I want it also.so what should i do?the mthod move is not easy.

Justice996 commented 1 year ago

99

我想压缩后保留dist目录以及子文件,但是不行

joket1999 commented 1 year ago

99

我想压缩后保留dist目录以及子文件,但是不行

The same with me.

sibiraj-s commented 1 year ago

You could do the following. onEnd accepts an array and guarantees order of execution.

{
  "onEnd": [
    {
      "copy": [{ "source": "./dist", "destination": "./someFolder/dist" }]
    },
    {
      "archive": [
        { "source": "./someFolder/", "destination": "..somelocation.zip" }
      ]
    }
  ]
}

Closing this as there is a way to solve this.