fix(client): relative import to src

This commit is contained in:
Elian Doran 2026-01-28 22:06:19 +02:00
parent 4a8fa7293b
commit 6de632d117
No known key found for this signature in database
2 changed files with 9 additions and 9 deletions

View File

@ -19,7 +19,7 @@ if (isDev) {
plugins = [
viteStaticCopy({
targets: assets.map((asset) => ({
src: `src/${asset}/*`,
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: __dirname,
cacheDir: '../../.cache/vite',
root: join(__dirname, "src"),
cacheDir: join(__dirname, "../../.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"),
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

@ -47,11 +47,11 @@ async function register(app: express.Application) {
vite.middlewares(req, res, next);
});
app.get(`/`, [ rootLimiter, auth.checkAuth, csrfMiddleware ], (req, res, next) => {
req.url = `/${assetUrlFragment}/src/index.html`;
req.url = `/${assetUrlFragment}/index.html`;
vite.middlewares(req, res, next);
});
app.get(`/index.ts`, [ rootLimiter ], (req, res, next) => {
req.url = `/${assetUrlFragment}/src/index.ts`;
req.url = `/${assetUrlFragment}/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")));
@ -66,7 +66,7 @@ async function register(app: express.Application) {
// broken when closing the browser and coming back in to the page.
// The page is restored from cache, but the API call fail.
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
res.sendFile(path.join(publicDir, "src", "index.html"));
res.sendFile(path.join(publicDir, "index.html"));
});
app.use("/assets", persistentCacheStatic(path.join(publicDir, "assets")));
app.use(`/src`, persistentCacheStatic(path.join(publicDir, "src")));