Skip to content

Commit

Permalink
fix cache expires issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven committed Jul 16, 2024
1 parent 0f6a7f8 commit 6f5d4ab
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
9 changes: 9 additions & 0 deletions nginx-frontend.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ http {
index index.html;
include /etc/nginx/mime.types;
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";
}

location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
root /usr/share/nginx/html;
expires 1h;
add_header Cache-Control "public";
}
}
}
11 changes: 10 additions & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default defineConfig(({ mode }) => {
Vue({
template: { transformAssetUrls }
}),
// https://github.com/vuetifyjs/vuetify-loader/tree/master/packages/vite-plugin#readme
Vuetify(),
Components(),
ViteFonts({
Expand Down Expand Up @@ -57,6 +56,16 @@ export default defineConfig(({ mode }) => {
'.vue',
],
},
build: {
outDir: 'dist',
rollupOptions: {
output: {
entryFileNames: 'assets/[name].[hash].js',
chunkFileNames: 'assets/[name].[hash].js',
assetFileNames: 'assets/[name].[hash].[ext]'
}
}
},
server: {
port: 3000,
},
Expand Down

0 comments on commit 6f5d4ab

Please sign in to comment.