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

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 负责人:无 分享
已邀请:
锦鲤丶接单丶

锦鲤丶接单丶 - 锦鲤丶接单丶18560000860丶10+年开发经验

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

锦鲤丶接单丶

锦鲤丶接单丶 - 锦鲤丶接单丶18560000860丶10+年开发经验

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

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

要回复问题请先登录注册