This commit is contained in:
魏啾
2024-05-22 14:31:07 +08:00
parent 7cd5649764
commit f832e312bf
7 changed files with 178 additions and 42 deletions

22
vue.config.js Normal file
View File

@@ -0,0 +1,22 @@
if (process.env.UNI_PLATFORM === 'h5') {
// 由于这种方式的打包,会导致编译生成微信小程序(只验证了微信小程序)无法正常使用,所以必须分开
let filePath = ''
let Timestamp = new Date().getTime()
module.exports = {
// ... webpack 相关配置
filenameHashing: false,
configureWebpack: { // webpack 配置 解决js缓存的问题目前只适配H5端打包
output: { // 输出重构 打包编译后的 文件目录 文件名称 【模块名称.时间戳】
filename: `${filePath}[name].js?v=${Timestamp}`,
chunkFilename: `${filePath}[name].js?v=${Timestamp}`
},
}
}
} else {
// 其他打包需要的相关配置
//由于vue-cli打包vue文件的时候静态文件会默认会带有hash值我们首先要去掉hash值。
module.exports = {
// ... webpack 相关配置
filenameHashing: false
}
}