From 7622a44bbb126507ae3fdd325993738ade940681 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 18 May 2026 00:31:55 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix=EF=BC=9A=E5=B0=9D=E8=AF=95=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20windows=20=E7=9A=84=E5=85=BC=E5=AE=B9=E6=80=A7?= =?UTF-8?q?=EF=BC=9AadditionalData:=20`@use=20"${pathResolve('src/styles/v?= =?UTF-8?q?ariables.scss')}"=20as=20*;`,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 45b472b08..60faba993 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,6 +1,6 @@ import {resolve} from 'path' import type {ConfigEnv, UserConfig} from 'vite' -import {loadEnv} from 'vite' +import {loadEnv, normalizePath} from 'vite' import {createVitePlugins} from './build/vite' import {exclude, include} from "./build/vite/optimize" // 当前执行node命令时文件夹的地址(工作目录) @@ -47,7 +47,7 @@ export default ({command, mode}: ConfigEnv): UserConfig => { }, preprocessorOptions: { scss: { - additionalData: `@use "${pathResolve('src/styles/variables.scss')}" as *;`, + additionalData: `@use "${normalizePath(pathResolve('src/styles/variables.scss'))}" as *;`, api: 'modern-compiler' } } From a2d043bc72390b5f2a7ab2a76073d46cf4651128 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 18 May 2026 00:47:16 +0800 Subject: [PATCH 2/3] fix: normalize scss variable injection on Windows - normalize injected variables.scss path for Windows Sass - skip variable-defining scss files to avoid duplicate global variables --- vite.config.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index 60faba993..a61ea7999 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -20,6 +20,7 @@ export default ({command, mode}: ConfigEnv): UserConfig => { } else { env = loadEnv(mode, root) } + const variablesScssPath = normalizePath(pathResolve('src/styles/variables.scss')) return { base: env.VITE_BASE_PATH, root: root, @@ -47,7 +48,18 @@ export default ({command, mode}: ConfigEnv): UserConfig => { }, preprocessorOptions: { scss: { - additionalData: `@use "${normalizePath(pathResolve('src/styles/variables.scss'))}" as *;`, + additionalData: (source: string, filename: string) => { + const normalizedFilename = normalizePath(filename) + // Windows 下更容易触发重复注入:定义或显式转导变量的文件,不能再次注入同一个 + // `@use ... as *`,否则 Sass 会报 duplicate global variables。 + if ( + normalizedFilename.endsWith('/src/styles/variables.scss') || + normalizedFilename.endsWith('/src/styles/global.module.scss') + ) { + return source + } + return `@use "${variablesScssPath}" as *;\n${source}` + }, api: 'modern-compiler' } } From d0cd93de5ad2437bebff0b578b29cfaeec22484d Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 18 May 2026 00:59:59 +0800 Subject: [PATCH 3/3] chore: fix eslint warnings from vite dev --- src/components/RouterSearch/index.vue | 2 +- src/layout/components/Footer/src/Footer.vue | 1 - src/layout/components/Menu/src/Menu.vue | 1 - .../components/TagsView/src/TagsView.vue | 10 ++--- src/utils/index.ts | 1 - .../erp/components/Demo03CourseForm.vue | 2 +- .../erp/components/Demo03CourseList.vue | 40 +++++++++---------- .../demo03/erp/components/Demo03GradeForm.vue | 2 +- .../demo03/erp/components/Demo03GradeList.vue | 40 +++++++++---------- src/views/infra/demo/demo03/erp/index.vue | 12 +++--- src/views/infra/demo/demo03/normal/index.vue | 24 +++++------ src/views/infra/file/index.vue | 14 +++++-- src/views/system/sms/log/index.vue | 2 +- .../system/sms/template/SmsTemplateForm.vue | 2 +- src/views/system/sms/template/index.vue | 2 +- 15 files changed, 80 insertions(+), 75 deletions(-) diff --git a/src/components/RouterSearch/index.vue b/src/components/RouterSearch/index.vue index 52425ec99..c3797e4b1 100644 --- a/src/components/RouterSearch/index.vue +++ b/src/components/RouterSearch/index.vue @@ -18,7 +18,7 @@
- + {{ t(item?.meta?.title as string) + - (item?.meta?.titleSuffix ? ` (${item?.meta?.titleSuffix})` : '') + (item?.meta?.titleSuffix ? ` (${item?.meta?.titleSuffix})` : '') }} (ary: Array, fn: Fn): number => { if (ary.findIndex) { return ary.findIndex(fn) diff --git a/src/views/infra/demo/demo03/erp/components/Demo03CourseForm.vue b/src/views/infra/demo/demo03/erp/components/Demo03CourseForm.vue index 29b5cf1dc..4959c00d7 100644 --- a/src/views/infra/demo/demo03/erp/components/Demo03CourseForm.vue +++ b/src/views/infra/demo/demo03/erp/components/Demo03CourseForm.vue @@ -7,7 +7,7 @@ label-width="100px" v-loading="formLoading" > - + diff --git a/src/views/infra/demo/demo03/erp/components/Demo03CourseList.vue b/src/views/infra/demo/demo03/erp/components/Demo03CourseList.vue index 4d45bac9f..8a6846a89 100644 --- a/src/views/infra/demo/demo03/erp/components/Demo03CourseList.vue +++ b/src/views/infra/demo/demo03/erp/components/Demo03CourseList.vue @@ -9,26 +9,26 @@ > 新增 - - 批量删除 - - - + 批量删除 + + + - + - - + +