mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-26 08:36:19 +08:00
fix: Docker 打包逻辑改进,彻底解决缓存问题 (#3473)
* feat: update nginx.conf 使用固定编译入口可能导致浏览器使用缓存js文件,而此配置可以解决 * feat: 更新docker打包逻辑: 原本固定的entry是为了方便替换环境变量,同时在nginx配置内让每次获取js等资源都不走缓存。这样的问题是首次打开会很慢。 因此本次使用的解决方案,回归vben原本的hash+timestamp的入口文件名,但是在环境变量替换的时候使用模糊匹配。 大家有类似需要可以参考环境变量的方式做 单镜像打包多环境的适配。
This commit is contained in:
@@ -36,7 +36,7 @@ function defineApplicationConfig(defineOptions: DefineOptions = {}) {
|
||||
});
|
||||
|
||||
const pathResolve = (pathname: string) => resolve(root, '.', pathname);
|
||||
|
||||
const timestamp = new Date().getTime();
|
||||
const applicationConfig: UserConfig = {
|
||||
base: VITE_PUBLIC_PATH,
|
||||
resolve: {
|
||||
@@ -64,7 +64,7 @@ function defineApplicationConfig(defineOptions: DefineOptions = {}) {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
// 入口文件名
|
||||
entryFileNames: 'assets/[name].js',
|
||||
entryFileNames: `assets/entry/[name]-[hash]-${timestamp}.js`,
|
||||
manualChunks: {
|
||||
vue: ['vue', 'pinia', 'vue-router'],
|
||||
antd: ['ant-design-vue', '@ant-design/icons-vue'],
|
||||
|
Reference in New Issue
Block a user