mirror of
https://github.com/zadam/trilium.git
synced 2026-02-01 11:24:25 +01:00
Vite fixes (#8537)
This commit is contained in:
commit
a373d2e7e0
@ -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>
|
||||
@ -30,7 +30,7 @@ async function initJQuery() {
|
||||
}
|
||||
|
||||
async function setupGlob() {
|
||||
const response = await fetch(`/bootstrap${window.location.search}`);
|
||||
const response = await fetch(`./bootstrap${window.location.search}`);
|
||||
const json = await response.json();
|
||||
|
||||
window.global = globalThis; /* fixes https://github.com/webpack/webpack/issues/10035 */
|
||||
|
||||
@ -85,7 +85,7 @@ export default defineConfig(() => ({
|
||||
sourcemap: false,
|
||||
rollupOptions: {
|
||||
input: {
|
||||
index: join(__dirname, "src", "index.html"),
|
||||
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"),
|
||||
|
||||
@ -47,10 +47,10 @@ 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) => {
|
||||
app.get(`/src/index.ts`, [ rootLimiter ], (req, res, next) => {
|
||||
req.url = `/${assetUrlFragment}/src/index.ts`;
|
||||
vite.middlewares(req, res, next);
|
||||
});
|
||||
@ -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")));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user