chore(client): use different root mechanism with fewer issues

This commit is contained in:
Elian Doran 2026-01-28 22:23:00 +02:00
parent 6de632d117
commit 37381b7c36
No known key found for this signature in database
3 changed files with 10 additions and 10 deletions

View File

@ -19,7 +19,7 @@
<!-- This works even when the user directly changes --root-background in CSS -->
<div id="background-color-tracker" style="position: absolute; visibility: hidden; color: var(--root-background); transition: color 1ms;"></div>
<script src="./index.ts" type="module"></script>
<script src="./src/index.ts" type="module"></script>
<!-- Required for correct loading of scripts in Electron -->
<script>

View File

@ -19,7 +19,7 @@ if (isDev) {
plugins = [
viteStaticCopy({
targets: assets.map((asset) => ({
src: `${asset}/*`,
src: `src/${asset}/*`,
dest: asset
}))
}),
@ -27,7 +27,7 @@ if (isDev) {
structured: true,
targets: [
{
src: "../../../node_modules/@excalidraw/excalidraw/dist/prod/fonts/*",
src: "../../node_modules/@excalidraw/excalidraw/dist/prod/fonts/*",
dest: "",
}
]
@ -37,8 +37,8 @@ if (isDev) {
}
export default defineConfig(() => ({
root: join(__dirname, "src"),
cacheDir: join(__dirname, "../../.cache/vite"),
root: __dirname,
cacheDir: '../../.cache/vite',
base: "",
plugins,
// Use esbuild for JSX transformation (much faster than Babel)
@ -79,14 +79,14 @@ export default defineConfig(() => ({
},
build: {
target: "esnext",
outDir: '../dist',
outDir: './dist',
emptyOutDir: true,
reportCompressedSize: true,
sourcemap: false,
rollupOptions: {
input: {
index: join(__dirname, "src", "index.html"),
login: join(__dirname, "src", "login.ts"),
index: join(__dirname, "index.html"),
login: join(__dirname, "src", "login.ts"),
setup: join(__dirname, "src", "setup.ts"),
set_password: join(__dirname, "src", "set_password.ts"),
runtime: join(__dirname, "src", "runtime.ts"),

View File

@ -50,8 +50,8 @@ async function register(app: express.Application) {
req.url = `/${assetUrlFragment}/index.html`;
vite.middlewares(req, res, next);
});
app.get(`/index.ts`, [ rootLimiter ], (req, res, next) => {
req.url = `/${assetUrlFragment}/index.ts`;
app.get(`/src/index.ts`, [ rootLimiter ], (req, res, next) => {
req.url = `/${assetUrlFragment}/src/index.ts`;
vite.middlewares(req, res, next);
});
app.use(`/node_modules/@excalidraw/excalidraw/dist/prod`, persistentCacheStatic(path.join(srcRoot, "../../node_modules/@excalidraw/excalidraw/dist/prod")));