From 13f4aa25b8b6d6d025621c85aaf71096bc86fa48 Mon Sep 17 00:00:00 2001 From: zdg Date: Tue, 19 Nov 2024 16:19:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96ppt=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron.vite.config.mjs | 3 ++- package.json | 1 - src/renderer/src/plugins/vite-ppt.js | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 src/renderer/src/plugins/vite-ppt.js diff --git a/electron.vite.config.mjs b/electron.vite.config.mjs index 0d56fc1..af97384 100644 --- a/electron.vite.config.mjs +++ b/electron.vite.config.mjs @@ -3,6 +3,7 @@ import path from 'path' import { defineConfig, externalizeDepsPlugin } from 'electron-vite' import vue from '@vitejs/plugin-vue' import WindiCSS from "vite-plugin-windicss" +import vitePpt from './src/renderer/src/plugins/vite-ppt' /*import electron from 'vite-plugin-electron' plugins: [electron({ main: { @@ -55,7 +56,7 @@ export default defineConfig({ } }, }, - plugins: [vue(), WindiCSS()], + plugins: [vue(), WindiCSS(),vitePpt()], assetsInclude:('**/*.woff', '**/*.woff2', '**/*.ttf'), } }) diff --git a/package.json b/package.json index 69ded97..1e81b04 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,6 @@ "svg-pathdata": "^7.1.0", "tinycolor2": "^1.6.0", "tippy.js": "^6.3.7", - "vue": "^3.4.34", "vuedraggable": "^4.1.0" }, "devDependencies": { diff --git a/src/renderer/src/plugins/vite-ppt.js b/src/renderer/src/plugins/vite-ppt.js new file mode 100644 index 0000000..cbdffd1 --- /dev/null +++ b/src/renderer/src/plugins/vite-ppt.js @@ -0,0 +1,20 @@ +/** + * @file vitePpt.js + * ppt-list 样式配置 + */ + +export default function vitePpt () { + return { + name: 'vite-ppt', + enforce: 'pre', + transform(code, id) { + if (id.endsWith('.scss')) { + // 使用 @use 代替 @import + code = code.replace(/@import\s+["']([^"']+)["'];/g, (match, importPath) => { + return `@use "${importPath}" as *;` + }) + } + return code + } + } +} \ No newline at end of file -- 2.44.0.windows.1