2024-06-14 01:49:25 +02:00
|
|
|
// Copyright 2024, Command Line Inc.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2024-07-19 00:16:49 +02:00
|
|
|
import react from "@vitejs/plugin-react-swc";
|
2024-06-14 01:49:25 +02:00
|
|
|
import { defineConfig } from "electron-vite";
|
2024-07-19 00:16:49 +02:00
|
|
|
import flow from "rollup-plugin-flow";
|
|
|
|
import { ViteImageOptimizer } from "vite-plugin-image-optimizer";
|
2024-06-14 01:49:25 +02:00
|
|
|
import { viteStaticCopy } from "vite-plugin-static-copy";
|
2024-07-30 20:44:19 +02:00
|
|
|
import svgr from "vite-plugin-svgr";
|
2024-06-14 01:49:25 +02:00
|
|
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
main: {
|
|
|
|
root: ".",
|
|
|
|
build: {
|
|
|
|
rollupOptions: {
|
|
|
|
input: {
|
2024-06-14 08:03:57 +02:00
|
|
|
index: "emain/emain.ts",
|
2024-06-14 01:49:25 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
outDir: "dist/main",
|
|
|
|
},
|
2024-07-19 00:16:49 +02:00
|
|
|
plugins: [tsconfigPaths(), flow()],
|
2024-06-26 21:22:27 +02:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
"@": "frontend",
|
|
|
|
},
|
|
|
|
},
|
2024-09-19 21:37:16 +02:00
|
|
|
define: {
|
|
|
|
"process.env.WS_NO_BUFFER_UTIL": "true",
|
|
|
|
"process.env.WS_NO_UTF_8_VALIDATE": "true",
|
|
|
|
},
|
2024-06-14 01:49:25 +02:00
|
|
|
},
|
|
|
|
preload: {
|
|
|
|
root: ".",
|
|
|
|
build: {
|
|
|
|
sourcemap: true,
|
|
|
|
rollupOptions: {
|
|
|
|
input: {
|
2024-06-14 08:03:57 +02:00
|
|
|
index: "emain/preload.ts",
|
2024-10-05 01:34:05 +02:00
|
|
|
"preload-webview": "emain/preload-webview.ts",
|
2024-06-14 01:49:25 +02:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
format: "cjs",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
outDir: "dist/preload",
|
|
|
|
},
|
2024-07-19 00:16:49 +02:00
|
|
|
plugins: [tsconfigPaths(), flow()],
|
2024-06-14 01:49:25 +02:00
|
|
|
},
|
|
|
|
renderer: {
|
|
|
|
root: ".",
|
|
|
|
build: {
|
|
|
|
target: "es6",
|
|
|
|
sourcemap: true,
|
|
|
|
outDir: "dist/frontend",
|
|
|
|
rollupOptions: {
|
|
|
|
input: {
|
2024-06-14 08:03:57 +02:00
|
|
|
index: "index.html",
|
2024-06-14 01:49:25 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-06-17 18:58:28 +02:00
|
|
|
server: {
|
|
|
|
open: false,
|
|
|
|
},
|
2024-06-14 01:49:25 +02:00
|
|
|
plugins: [
|
2024-07-19 00:16:49 +02:00
|
|
|
ViteImageOptimizer(),
|
2024-06-14 01:49:25 +02:00
|
|
|
tsconfigPaths(),
|
2024-08-06 01:13:26 +02:00
|
|
|
svgr({
|
|
|
|
svgrOptions: { exportType: "default", ref: true, svgo: false, titleProp: true },
|
|
|
|
include: "**/*.svg",
|
|
|
|
}),
|
2024-07-19 00:16:49 +02:00
|
|
|
react({}),
|
|
|
|
flow(),
|
2024-06-14 01:49:25 +02:00
|
|
|
viteStaticCopy({
|
|
|
|
targets: [{ src: "node_modules/monaco-editor/min/vs/*", dest: "monaco" }],
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
},
|
|
|
|
});
|