mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 15:27:46 +00:00
Merge pull request #4927 from Infisical/feat/cache-fix-spa
feat: added spa cache control
This commit is contained in:
@@ -34,6 +34,7 @@ ENV VITE_POSTHOG_API_KEY $POSTHOG_API_KEY
|
|||||||
ARG INTERCOM_ID
|
ARG INTERCOM_ID
|
||||||
ENV VITE_INTERCOM_ID $INTERCOM_ID
|
ENV VITE_INTERCOM_ID $INTERCOM_ID
|
||||||
ARG INFISICAL_PLATFORM_VERSION
|
ARG INFISICAL_PLATFORM_VERSION
|
||||||
|
ENV INFISICAL_PLATFORM_VERSION $INFISICAL_PLATFORM_VERSION
|
||||||
ENV VITE_INFISICAL_PLATFORM_VERSION $INFISICAL_PLATFORM_VERSION
|
ENV VITE_INFISICAL_PLATFORM_VERSION $INFISICAL_PLATFORM_VERSION
|
||||||
ARG CAPTCHA_SITE_KEY
|
ARG CAPTCHA_SITE_KEY
|
||||||
ENV VITE_CAPTCHA_SITE_KEY $CAPTCHA_SITE_KEY
|
ENV VITE_CAPTCHA_SITE_KEY $CAPTCHA_SITE_KEY
|
||||||
|
|||||||
@@ -43,7 +43,9 @@ export const registerServeUI = async (
|
|||||||
const frontendPath = path.join(dir, frontendName);
|
const frontendPath = path.join(dir, frontendName);
|
||||||
await server.register(staticServe, {
|
await server.register(staticServe, {
|
||||||
root: frontendPath,
|
root: frontendPath,
|
||||||
wildcard: false
|
wildcard: false,
|
||||||
|
maxAge: "30d",
|
||||||
|
immutable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
server.route({
|
server.route({
|
||||||
@@ -58,11 +60,12 @@ export const registerServeUI = async (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This should help avoid caching any chunks (temp fix)
|
return reply.sendFile("index.html", {
|
||||||
void reply.header("Cache-Control", "no-cache, no-store, must-revalidate, private, max-age=0");
|
immutable: false,
|
||||||
void reply.header("Pragma", "no-cache");
|
maxAge: 0,
|
||||||
void reply.header("Expires", "0");
|
lastModified: false,
|
||||||
return reply.sendFile("index.html");
|
etag: false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
@import "tailwindcss";
|
@import "tailwindcss";
|
||||||
|
|
||||||
@import "@fontsource/inter/400.css" layer(base);
|
|
||||||
@import "@fontsource/inter/500.css" layer(base);
|
|
||||||
@import "@fontsource/inter/700.css" layer(base);
|
|
||||||
|
|
||||||
@source not "../public";
|
@source not "../public";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import { NotFoundPage } from "./pages/public/NotFoundPage/NotFoundPage";
|
|||||||
// Import the generated route tree
|
// Import the generated route tree
|
||||||
import { routeTree } from "./routeTree.gen";
|
import { routeTree } from "./routeTree.gen";
|
||||||
|
|
||||||
|
import "@fontsource/inter/400.css";
|
||||||
|
import "@fontsource/inter/500.css";
|
||||||
import "@xyflow/react/dist/style.css";
|
import "@xyflow/react/dist/style.css";
|
||||||
import "nprogress/nprogress.css";
|
import "nprogress/nprogress.css";
|
||||||
import "react-toastify/dist/ReactToastify.css";
|
import "react-toastify/dist/ReactToastify.css";
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ const virtualRouteFileChangeReloadPlugin: PluginOption = {
|
|||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig(({ mode }) => {
|
||||||
const env = loadEnv(mode, process.cwd());
|
const env = loadEnv(mode, process.cwd());
|
||||||
const allowedHosts = env.VITE_ALLOWED_HOSTS?.split(",") ?? [];
|
const allowedHosts = env.VITE_ALLOWED_HOSTS?.split(",") ?? [];
|
||||||
|
const version = (
|
||||||
|
env.INFISICAL_PLATFORM_VERSION ||
|
||||||
|
env.VITE_INFISICAL_PLATFORM_VERSION ||
|
||||||
|
"0.0.1"
|
||||||
|
).replaceAll(".", "-");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
server: {
|
server: {
|
||||||
@@ -38,6 +43,15 @@ export default defineConfig(({ mode }) => {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
|
build: {
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
entryFileNames: `assets/[name]-${version}-[hash].js`,
|
||||||
|
chunkFileNames: `assets/[name]-${version}-[hash].js`,
|
||||||
|
assetFileNames: `assets/[name]-${version}-[hash].[ext]`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
tsconfigPaths(),
|
tsconfigPaths(),
|
||||||
nodePolyfills({
|
nodePolyfills({
|
||||||
|
|||||||
Reference in New Issue
Block a user