const FileManagerPlugin = require('filemanager-webpack-plugin')

const FStream = require('fs');

 

const myVersionFile_path = 'public/version.js';

const myOptDir = process.cwd().split(/[\\/]/).pop();

function setVersion(config) {

  const version = new Date().getTime();

  config.plugins[1].definitions['process.env'].VUE_APP_VERSION = version;

  FStream.writeFileSync(myVersionFile_path, version)

}

 

console.log(process.env.VUE_APP_NODE_ENV === 'production', process.env.VUE_APP_NODE_ENV)

function migrateFile_and_compressDir(config) {

  console.log(process.env.VUE_APP_NODE_ENV === 'production')

  if (process.env.VUE_APP_NODE_ENV === 'production') {

    /*  generate   Copy version number file ,  And compress the file  */

    let fileManagerPlugin = new FileManagerPlugin({

      onEnd: {

        copy: [{source: myVersionFile_path, destination: myOptDir},],

        archive: [{source: myOptDir, destination: `${myOptDir}.zip`, format: 'zip',}]

      }

    });

    config.plugins.push(fileManagerPlugin);

  }

}

 

module.exports.my_configPackaging = function my_configPackaging(config) {

  setVersion(config);

  migrateFile_and_compressDir(config);

}

module.exports.myOptDir = myOptDir

 

Technology
©2020 ioDraw All rights reserved
Java exercises 1: Simply define a car class New photo album app launched by Microsoft : Using cross platform framework React Native to write Chapter two Fundamentals of programming Programming exercises pandas Time order of webpack Code segmentation import()Vue slot slot: Default slot , Named slot , Scope slot Fundamentals of data analysis ——R language ( Processing missing values )C++ Implementation of matrix meteor shower effect PostMan Advanced Usage , Interface MD5+Secret autograph Sign The 12th Blue Bridge Cup B group C/C++ Provincial competition