From 25751b8149117377c2005ea8a2edbb042122aa44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sat, 16 Nov 2024 11:39:12 +0800 Subject: [PATCH] fix --- vite.config.ts | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 512d7199..f416c9c3 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,14 +3,12 @@ import { defineConfig, PluginOption, UserConfig } from 'vite'; import { resolve } from 'path'; import nodeResolve from '@rollup/plugin-node-resolve'; import { builtinModules } from 'module'; - -const external = ['silk-wasm', 'ws', 'express', 'qrcode-terminal', 'fluent-ffmpeg', 'piscina']; -const nodeModules = [...builtinModules, builtinModules.map(m => `node:${m}`)].flat(); - +//依赖排除 +const external = ['silk-wasm', 'ws', 'express', 'qrcode-terminal', 'fluent-ffmpeg']; +const nodeModules = [...builtinModules, builtinModules.map((m) => `node:${m}`)].flat(); function genCpModule(module: string) { return { src: `./node_modules/${module}`, dest: `dist/node_modules/${module}`, flatten: false }; } - let startScripts: string[] | undefined = undefined; if (process.env.NAPCAT_BUILDSYS == 'linux') { startScripts = []; @@ -19,7 +17,6 @@ if (process.env.NAPCAT_BUILDSYS == 'linux') { } else { startScripts = ['./script/KillQQ.bat']; } - const FrameworkBaseConfigPlugin: PluginOption[] = [ cp({ targets: [ @@ -68,14 +65,14 @@ const ShellBaseConfig = () => target: 'esnext', minify: false, lib: { - entry: { - 'napcat': 'src/shell/napcat.ts', - 'audio-worker': 'src/common/audio-worker.ts', - }, + entry: 'src/shell/napcat.ts', formats: ['es'], - fileName: (_, entryName) => `${entryName}.mjs`, - } - } + fileName: () => 'napcat.mjs', + }, + rollupOptions: { + external: [...nodeModules, ...external], + }, + }, }); const FrameworkBaseConfig = () => @@ -93,14 +90,14 @@ const FrameworkBaseConfig = () => target: 'esnext', minify: false, lib: { - entry: { - 'napcat': 'src/framework/napcat.ts', - 'audio-worker': 'src/common/audio-worker.ts', - }, + entry: 'src/framework/napcat.ts', formats: ['es'], - fileName: (_, entryName) => `${entryName}.mjs`, + fileName: () => 'napcat.mjs', }, - } + rollupOptions: { + external: [...nodeModules, ...external], + }, + }, }); export default defineConfig(({ mode }): UserConfig => {