1. 程式人生 > 其它 >cli4 打包新增時間戳

cli4 打包新增時間戳

let timeStamp = new Date().getTime();

module.exports = {
  // publicPath: process.env.NODE_ENV === "production" ? "/evaluation-app/" : "/",
  publicPath: "./",
  chainWebpack: config => {
    config
      .plugin('html')
      .tap(args => {
        args[0].title = '考核評價'
        return args
      }),
      
// 在chainWebpack中新增下面的程式碼 // config.entry('main').add('babel-polyfill') // main是入口js檔案 config.module.rule('js').test(/\.js$/).use('babel-loader').loader('babel-loader') }, configureWebpack: config => { config.entry.app = ["babel-polyfill", "./src/main.js"]; }, // css: { //重點. // extract: { // 打包後css檔名稱新增時間戳
// filename: `css/[name].${ timeStamp }.css`, // chunkFilename: `css/[name].${ timeStamp }.css`, // } // }, // configureWebpack: { //重點 // output: { // 輸出重構 打包編譯後的 檔名稱 【模組名稱.版本號.時間戳】 // filename: `[name].${ timeStamp }.js`, // chunkFilename: `[name].${ timeStamp }.js` // }, //} //
選項... filenameHashing: false, // 打包的時候不使用hash值.因為我們有時間戳來確定專案的唯一性了. }