perf: avoid silk encoding blocking the main event loop (#527)
This commit is contained in:
1 parent
fec1b0d3b8
commit
27d3f6ee18
4 files changed
+44
-16
No files matched your search
+15
-6
@@ -3,12 +3,14 @@ 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'];
|
||||
|
||||
const external = ['silk-wasm', 'ws', 'express', 'qrcode-terminal', 'fluent-ffmpeg', 'piscina'];
|
||||
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 = [];
|
||||
@@ -17,6 +19,7 @@ if (process.env.NAPCAT_BUILDSYS == 'linux') {
|
||||
} else {
|
||||
startScripts = ['./script/KillQQ.bat'];
|
||||
}
|
||||
|
||||
const FrameworkBaseConfigPlugin: PluginOption[] = [
|
||||
cp({
|
||||
targets: [
|
||||
@@ -66,9 +69,12 @@ const ShellBaseConfig = () => defineConfig({
|
||||
target: 'esnext',
|
||||
minify: false,
|
||||
lib: {
|
||||
entry: 'src/shell/napcat.ts',
|
||||
entry: {
|
||||
'napcat': 'src/shell/napcat.ts',
|
||||
'audio-worker': 'src/common/audio-worker.ts',
|
||||
},
|
||||
formats: ['es'],
|
||||
fileName: () => 'napcat.mjs',
|
||||
fileName: (_, entryName) => `${entryName}.mjs`,
|
||||
},
|
||||
rollupOptions: {
|
||||
external: [...nodeModules, ...external],
|
||||
@@ -90,9 +96,12 @@ const FrameworkBaseConfig = () => defineConfig({
|
||||
target: 'esnext',
|
||||
minify: false,
|
||||
lib: {
|
||||
entry: 'src/framework/napcat.ts',
|
||||
entry: {
|
||||
'napcat': 'src/framework/napcat.ts',
|
||||
'audio-worker': 'src/common/audio-worker.ts',
|
||||
},
|
||||
formats: ['es'],
|
||||
fileName: () => 'napcat.mjs',
|
||||
fileName: (_, entryName) => `${entryName}.mjs`,
|
||||
},
|
||||
rollupOptions: {
|
||||
external: [...nodeModules, ...external],
|
||||
|
||||
Reference in new issue
Block a user