l***@163.com
l***@163.com
  • 发布:2024-03-26 13:33
  • 更新:2024-03-26 13:42
  • 阅读:576

uniapp使用vue3开发的项目,使用vue.config.js打包设置js文件增加版本号,时间戳不生效

分类:uni-app
let filePath = ''  
let Timestamp = ''  

if (process.env.UNI_PLATFORM === 'h5') {  
  filePath = 'static/js/';  
  Timestamp = '.' + new Date().getTime();  

}  

module.exports = {  
  configureWebpack: {   
    output: {   
      filename: `${filePath}[name]${Timestamp}.js`,  
      chunkFilename: `${filePath}[name]${Timestamp}.js`  
    },  
  },  
}  

打包后的项目没有任何变化,但是vue2使用以上配置是生效的

2024-03-26 13:33 负责人:无 分享
已邀请:
锦鲤_接单

锦鲤_接单 - 开发、设计、新媒体运营

vue3版本用的vite,然后vite里面用的是rollup了,并非webpack了

锦鲤_接单

锦鲤_接单 - 开发、设计、新媒体运营

https://cn.vitejs.dev/config/build-options.html#build-rollupoptions

https://rollupjs.org/configuration-options/#output-chunkfilenames

要回复问题请先登录注册