mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
0d4be9cb88
This was a weird one, apparently Storybook still uses CJS but Vite has fully deprecated CJS support. So we need to dynamically import the electron.vite.config.ts file for Storybook, but this breaks because Typescript doesn't resolve and properly compile the dynamic import. To get around this, I am using the `tsx` package, which can dynamically compile typescript imports.
59 lines
1.4 KiB
TypeScript
59 lines
1.4 KiB
TypeScript
// Copyright 2024, Command Line Inc.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import react from "@vitejs/plugin-react";
|
|
import { defineConfig } from "electron-vite";
|
|
import { viteStaticCopy } from "vite-plugin-static-copy";
|
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
|
|
export default defineConfig({
|
|
main: {
|
|
root: ".",
|
|
build: {
|
|
rollupOptions: {
|
|
input: {
|
|
index: "emain/emain.ts",
|
|
},
|
|
},
|
|
outDir: "dist/main",
|
|
},
|
|
plugins: [tsconfigPaths()],
|
|
},
|
|
preload: {
|
|
root: ".",
|
|
build: {
|
|
sourcemap: true,
|
|
rollupOptions: {
|
|
input: {
|
|
index: "emain/preload.ts",
|
|
},
|
|
output: {
|
|
format: "cjs",
|
|
},
|
|
},
|
|
outDir: "dist/preload",
|
|
},
|
|
plugins: [tsconfigPaths()],
|
|
},
|
|
renderer: {
|
|
root: ".",
|
|
build: {
|
|
target: "es6",
|
|
sourcemap: true,
|
|
outDir: "dist/frontend",
|
|
rollupOptions: {
|
|
input: {
|
|
index: "index.html",
|
|
},
|
|
},
|
|
},
|
|
plugins: [
|
|
react({}),
|
|
tsconfigPaths(),
|
|
viteStaticCopy({
|
|
targets: [{ src: "node_modules/monaco-editor/min/vs/*", dest: "monaco" }],
|
|
}),
|
|
],
|
|
},
|
|
});
|