Files
everyone-can-use-english/enjoy/vite.main.config.mts
an-lee 5efc5fc1db Feat: AI commands (#145)
* upgrade deps

* add extract command

* add lookup.command

* update lookup command

* fix locals

* may lookup one by one

* update lookup method

* add translate command

* cache translation by default

* open ai default settings

* use openai config in context

* refactor

* genreate ipa

* update UI

* handle ai generate fail
2024-01-19 16:52:49 +08:00

64 lines
1.6 KiB
TypeScript

import { defineConfig } from "vite";
import { viteStaticCopy } from "vite-plugin-static-copy";
import path from "path";
import os from "os";
// https://vitejs.dev/config
export default defineConfig({
resolve: {
// Some libs that can run in both Web and Node.js, such as `axios`, we need to tell Vite to build them in Node.js.
browserField: false,
mainFields: ["module", "jsnext:main", "jsnext"],
alias: {
"@": path.resolve(__dirname, "./src"),
"@main": path.resolve(__dirname, "./src/main"),
"@commands": path.resolve(__dirname, "./src/commands"),
},
},
build: {
rollupOptions: {
external: [
"sequelize",
"umzug",
"sqlite3",
"fluent-ffmpeg",
"bufferutil",
"utf-8-validate",
// "node-llama-cpp",
],
},
},
plugins: [
viteStaticCopy({
targets: [
{
src: `lib/whisper.cpp/${
process.env.PACKAGE_OS_ARCH || os.arch()
}/${os.platform()}/*`,
dest: "lib/whisper",
},
{
src: `lib/youtubedr/${
process.env.PACKAGE_OS_ARCH || os.arch()
}/${os.platform()}/*`,
dest: "lib/youtubedr",
},
{
src: `lib/ffmpeg//${
process.env.PACKAGE_OS_ARCH || os.arch()
}/${os.platform()}/*`,
dest: "lib/ffmpeg",
},
{
src: "src/main/db/migrations/*",
dest: "migrations",
},
{
src: "samples/*",
dest: "samples",
},
],
}),
],
});