From e7348107d0e1c623037b9e7ecd5b8b6ad4482977 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Fri, 28 Mar 2025 09:38:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3forge=E5=BA=93=E5=9C=A8?= =?UTF-8?q?=E6=A1=8C=E9=9D=A2=E7=AB=AF=E6=97=A0=E6=B3=95=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/package.json | 1 + frontend/vite.config.ts | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/frontend/package.json b/frontend/package.json index 0cbf3b6..ce0669c 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -76,6 +76,7 @@ "vite-plugin-compression": "^0.5.1", "vite-plugin-eslint": "^1.8.1", "vite-plugin-html": "^3.2.0", + "vite-plugin-node-polyfills": "^0.23.0", "vite-plugin-pwa": "^0.16.5", "vite-plugin-svg-icons": "^2.0.1", "vue-tsc": "^2.0.21" diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index d0b6745..ea5e84b 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -10,6 +10,7 @@ import vueJsx from "@vitejs/plugin-vue-jsx"; import AutoImport from "unplugin-auto-import/vite"; import Components from "unplugin-vue-components/vite"; import { ElementPlusResolver } from "unplugin-vue-components/resolvers"; +import { nodePolyfills } from 'vite-plugin-node-polyfills'; export default defineConfig(({ mode }: ConfigEnv): UserConfig => { const root = process.cwd(); @@ -59,6 +60,12 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { dts: false, // dts: "src/types/components.d.ts", }), + nodePolyfills({ + include: ['crypto'], + globals: { + crypto: true, + }, + }), ], // 基础配置 base: viteEnv.VITE_PUBLIC_PATH,