clan-app: Fix npm run build in ui-2d

This commit is contained in:
Qubasa
2025-06-18 20:56:52 +02:00
parent 4f60dbfe28
commit f47db5f7c1
5 changed files with 163 additions and 3 deletions

View File

@@ -1 +0,0 @@
../ui/vite.config.ts

View File

@@ -0,0 +1,54 @@
import { defineConfig } from "vite";
import solidPlugin from "vite-plugin-solid";
import solidSvg from "vite-plugin-solid-svg";
import devtools from "solid-devtools/vite";
import path from "node:path";
import { exec } from "child_process";
// watch also clan-cli to catch api changes
const clanCliDir = path.resolve(__dirname, "../../clan-cli");
function regenPythonApiOnFileChange() {
return {
name: "run-python-script-on-change",
handleHotUpdate({}) {
exec("reload-python-api.sh", (err, stdout, stderr) => {
if (err) {
console.error(`reload-python-api.sh error:\n${stderr}`);
}
});
},
configureServer(server: import("vite").ViteDevServer) {
server.watcher.add([clanCliDir]);
},
};
}
export default defineConfig({
resolve: {
alias: {
"@": path.resolve(__dirname, "./"), // This now points to ui-2d directory
},
},
optimizeDeps: {
include: ["debug", "extend"],
},
plugins: [
/*
Uncomment the following line to enable solid-devtools.
For more info see https://github.com/thetarnav/solid-devtools/tree/main/packages/extension#readme
*/
devtools(),
solidPlugin(),
solidSvg(),
regenPythonApiOnFileChange(),
],
server: {
port: 3000,
},
build: {
target: "safari11",
// assetsDi
manifest: true,
},
});