Vue-cli 3.0 package how to add version numbers to js and css, and how to change the names of js and css

vue-cli 3.0 packages how to add version numbers to js and css, and how to change the names of js and css.

Jul.08,2022

create the file vue.config.js in the root directory of the project, and then configure the corresponding packaged output in the file, as follows:

clipboard.png

const path = require("path");
const systemConfig = require("./src/lib/system.config");   //
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
  configureWebpack: {
    output: {
      //      .
      filename: `js/[name].${systemConfig.version}.js`,
      chunkFilename: `js/[name].${systemConfig.version}.js`
    },
    plugins: [
      new MiniCssExtractPlugin({
        // css
        filename: `css/[name].${systemConfig.version}.css`,
        chunkFilename: `css/[name].${systemConfig.version}.css`
      })
    ]
  },
  // img
  chainWebpack: config => {
    config.module
      .rule("images")
      .use("url-loader")
      .tap(options => {
        options.name = `img/[name].${systemConfig.version}.[ext]`;
        options.fallback = {
          loader: "file-loader",
          options: {
            name: `img/[name].${systemConfig.version}.[ext]`
          }
        };
        return options;
      });
  },
 
};

const Timestamp = new Date (). GetTime (); / / timestamp
module.exports = {
configureWebpack: {/ / webpack configuration

output: { //      ..
  filename: `[name].${process.env.VUE_APP_Version}.${Timestamp}.js`,
  chunkFilename: `[name].${process.env.VUE_APP_Version}.${Timestamp}.js`
},

},
...
}

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c18cf0-33107.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c18cf0-33107.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?