From 999465cc50a81c5dad8946829657b2cf99857d3a Mon Sep 17 00:00:00 2001 From: Yuzhong Zhang <141388234+BetterAndBetterII@users.noreply.github.com> Date: Sat, 5 Jul 2025 23:45:23 +0800 Subject: [PATCH] Add option to disable vite checker via env variable Introduced the DISABLE_VITE_CHECKER environment variable to conditionally disable the vite checker plugin in the build process. Updated the Dockerfile to set this variable during the Docker build, allowing builds to bypass vite checker when needed. --- excalidraw-complete.Dockerfile | 2 +- excalidraw/excalidraw-app/vite.config.mts | 24 ++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/excalidraw-complete.Dockerfile b/excalidraw-complete.Dockerfile index 037f676..d6463bd 100644 --- a/excalidraw-complete.Dockerfile +++ b/excalidraw-complete.Dockerfile @@ -4,7 +4,7 @@ WORKDIR /app # 复制 excalidraw 子模块 COPY excalidraw/ ./excalidraw/ # 构建前端 -RUN cd excalidraw && npm install -g pnpm && pnpm install && cd excalidraw-app && pnpm build:app:docker +RUN cd excalidraw && npm install -g pnpm && pnpm install && cd excalidraw-app && DISABLE_VITE_CHECKER=true pnpm build:app:docker # 后端构建阶段 FROM golang:alpine AS backend-builder diff --git a/excalidraw/excalidraw-app/vite.config.mts b/excalidraw/excalidraw-app/vite.config.mts index 5576d6d..d6acd43 100644 --- a/excalidraw/excalidraw-app/vite.config.mts +++ b/excalidraw/excalidraw-app/vite.config.mts @@ -51,17 +51,19 @@ export default defineConfig({ }, plugins: [ react(), - checker({ - typescript: true, - eslint: - envVars.VITE_APP_ENABLE_ESLINT === "false" - ? undefined - : { lintCommand: 'eslint "./**/*.{js,ts,tsx}"' }, - overlay: { - initialIsOpen: envVars.VITE_APP_COLLAPSE_OVERLAY === "false", - badgeStyle: "margin-bottom: 4rem; margin-left: 1rem", - }, - }), + process.env.DISABLE_VITE_CHECKER + ? undefined + : checker({ + typescript: true, + eslint: + envVars.VITE_APP_ENABLE_ESLINT === "false" + ? undefined + : { lintCommand: 'eslint "./**/*.{js,ts,tsx}"' }, + overlay: { + initialIsOpen: envVars.VITE_APP_COLLAPSE_OVERLAY === "false", + badgeStyle: "margin-bottom: 4rem; margin-left: 1rem", + }, + }), svgrPlugin(), ViteEjsPlugin(), VitePWA({