| 123456789101112131415161718 |
- let filePath = ''; // 默认文件路径
- let TimeStamp = ''; // 时间戳
- let Version = '-V1.0.1-'; // 版本号
- //编译环境判断,可以根据不同环境来做相应的配置
- if (process.env.UNI_PLATFORM === 'h5') {
- filePath = 'static/js/'
- TimeStamp = new Date().getTime();
- process.env.VUE_APP_INDEX_CSS_HASH=`${Version}${TimeStamp}` //给css文件也使用该时间戳
- }
-
- module.exports = {
- configureWebpack: {
- output: { //重构文件名
- filename: `${filePath}[name].${Version}${TimeStamp}.js`, // index文件重命名为带有版本号+时间戳的格式
- chunkFilename: `${filePath}[name].${Version}${TimeStamp}.js` // static/js/pages-home-index.-V1-754654657.js
- },
- },
- }
|