From dfd0467f472a03f53cf1c9ad4abb6475da3acd1d Mon Sep 17 00:00:00 2001 From: z30057876 Date: Fri, 25 Apr 2025 01:25:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 1 - deploy/prod/nginx.conf.tmpl | 10 +--------- package.json | 1 - vite.config.ts | 12 +----------- 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index feb537c..0ddb6b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,6 @@ RUN npm install pnpm -g --registry=https://registry.npmmirror.com && \ pnpm install --registry=https://registry.npmmirror.com && \ pnpm run build - FROM hub.oepkgs.net/openeuler/openeuler:22.03-lts-sp4 ENV TZ Asia/Shanghai diff --git a/deploy/prod/nginx.conf.tmpl b/deploy/prod/nginx.conf.tmpl index d91f5f6..f032823 100644 --- a/deploy/prod/nginx.conf.tmpl +++ b/deploy/prod/nginx.conf.tmpl @@ -67,10 +67,7 @@ http { add_header Referrer-Policy "no-referrer"; add_header X-Content-Type-Options nosniff; add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: base64;"; - add_header Cache-Control "no-cache,no-store,must-revalidate"; - add_header Pragma no-cache; - add_header Expires 0; - # limit_conn limitperip 10; + add_header Cache-Control "no-cache"; if ($request_method !~ ^(GET|HEAD|POST|PUT|DELETE)$) { return 444; @@ -102,13 +99,8 @@ http { location /witchaind/api/ { proxy_set_header X-Real-IP $remote_addr; - add_header X-XSS-Protection "1; mode=block"; add_header X-Frame-Options DENY; - add_header X-Content-Type-Options nosniff; - add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: base64;"; add_header Cache-Control "no-cache,no-store,must-revalidate"; - add_header Pragma no-cache; - add_header Expires 0; proxy_buffering off; error_page 404 = @not_found; diff --git a/package.json b/package.json index ab97dd9..4389f87 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,6 @@ "stylelint-config-recommended-scss": "^14.1.0", "stylelint-config-recommended-vue": "^1.5.0", "stylelint-config-standard": "^36.0.1", - "terser": "^5.31.6", "typescript": "^5.5.4", "unocss": "^0.58.9", "unplugin-auto-import": "^0.17.8", diff --git a/vite.config.ts b/vite.config.ts index 4f64568..c6f69d7 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -203,17 +203,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { // 构建配置 build: { chunkSizeWarningLimit: 2000, // 消除打包大小超过500kb警告 - minify: 'terser', // Vite 2.6.x 以上需要配置 minify: "terser", terserOptions 才能生效 - terserOptions: { - compress: { - keep_infinity: true, // 防止 Infinity 被压缩成 1/0,这可能会导致 Chrome 上的性能问题 - drop_console: true, // 生产环境去除 console - drop_debugger: true, // 生产环境去除 debugger - }, - format: { - comments: false, // 删除注释 - }, - }, + minify: 'esbuild', rollupOptions: { output: { // 用于从入口点创建的块的打包输出格式[name]表示文件名,[hash]表示该文件内容hash值 -- Gitee