Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"typescript": "~4.9.5",
"unplugin-vue-components": "^0.25.2",
"vite": "3",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-pwa": "^0.16.5",
"vite-plugin-wasm": "^3.4.1",
"vue-cli-plugin-vuetify": "~2.4.1",
Expand Down
9 changes: 9 additions & 0 deletions core/frontend/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Components from 'unplugin-vue-components/vite'
import { defineConfig, loadEnv } from 'vite'
import { sentryVitePlugin } from "@sentry/vite-plugin";
import { VitePWA } from 'vite-plugin-pwa'
import viteCompression from 'vite-plugin-compression'
import wasm from "vite-plugin-wasm"
const { name } = require('./package.json')

Expand Down Expand Up @@ -100,6 +101,14 @@ export default defineConfig(({ command, mode }) => {
removeNonJson(repoPath)
}
},
// Pre-compress assets with gzip for nginx to serve via gzip_static always
viteCompression({
algorithm: 'gzip',
ext: '.gz',
threshold: 1024,
deleteOriginFile: true,
filter: /\.(js|css|json|svg|txt|xml|wasm|glb)$/i,
}),
],
assetsInclude: ['**/*.gif', '**/*.glb', '**/*.png', '**/*.svg', '**/*.msg', "**/three/examples/jsm/libs/draco/*"],
resolve: {
Expand Down
4 changes: 3 additions & 1 deletion core/tools/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

# Serve pre-compressed .gz files even without originals (requires client gzip support)
gzip_static always;

# Cache
proxy_cache_path /var/cache/nginx keys_zone=ourcache:10m levels=1:2 max_size=1g inactive=30d;

Expand Down Expand Up @@ -265,7 +268,6 @@ http {

location /assets/ {
root /home/pi/frontend;
try_files $uri $uri/;
autoindex on;
add_header Cache-Control "public, max-age=604800";
}
Expand Down