From 4974aa6d80e4a4bbf0cc0813ec62c90ec1919e8e Mon Sep 17 00:00:00 2001 From: issam-seghir Date: Thu, 14 Dec 2023 16:44:23 +0100 Subject: [PATCH] =?UTF-8?q?Max=20performance=20=F0=9F=94=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jsx/components/Hemlet/Preload.jsx | 7 +++- tsconfig.json | 58 --------------------------- vite.config.js | 24 ++++++----- 3 files changed, 20 insertions(+), 69 deletions(-) delete mode 100644 tsconfig.json diff --git a/src/jsx/components/Hemlet/Preload.jsx b/src/jsx/components/Hemlet/Preload.jsx index 74e9110..bad82b0 100644 --- a/src/jsx/components/Hemlet/Preload.jsx +++ b/src/jsx/components/Hemlet/Preload.jsx @@ -4,8 +4,11 @@ import { useTheme } from "@mui/joy/styles"; export default function Preload() { const theme = useTheme(); const isDark = theme.palette.mode === "dark"; - const preloadGifDark = "src/assets/gifs/giphy-downsized.gif"; - const preloadGifLight = "src/assets/gifs/looking-water.gif"; + // Define paths based on environment + const preloadGifDark = import.meta.env.DEV ? "src/assets/gifs/giphy-downsized.gif" : "giphy-downsized.gif"; // Adjust the paths accordingly for production + + const preloadGifLight = import.meta.env.DEV ? "src/assets/gifs/looking-water.gif" : "looking-water.gif"; // Adjust the paths accordingly for production + return ( diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 5f8d75e..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "@assets/*": [ - "src/assets/*" - ], - "@jsx/*": [ - "src/jsx/*" - ], - "@scss/*": [ - "src/scss/*" - ], - "@gifs/*": [ - "src/assets/gifs/*" - ], - "@images/*": [ - "src/assets/images/*" - ], - "@components/*": [ - "src/jsx/components/*" - ], - "@contexts/*": [ - "src/jsx/contexts/*" - ], - "@data/*": [ - "src/jsx/data/*" - ], - "@pages/*": [ - "src/jsx/pages/*" - ], - "@utils/*": [ - "src/jsx/utils/*" - ], - "@abstracts/*": [ - "src/scss/abstracts/*" - ], - "@base/*": [ - "src/scss/base/*" - ], - "@scssComponents/*": [ - "src/scss/components/*" - ], - "@utilities/*": [ - "src/scss/utilities/*" - ], - "@/*": [ - "src/*" - ], - "@Hemlet/*": [ - "src/jsx/Hemlet/*" - ], - "@jsxComponentsHemlet/*": [ - "src/jsx/components/Hemlet/*" - ] - } - } -} \ No newline at end of file diff --git a/vite.config.js b/vite.config.js index 00504ec..6c24b99 100644 --- a/vite.config.js +++ b/vite.config.js @@ -9,18 +9,24 @@ export default defineConfig(({ command, mode, ssrBuild }) => ({ // Getting rid of hashes in generated filenames filenameHashing: true, build: { - sourcemap: true, // cssMinify: false, // disable CSS minify only // minify: false, // disable CSS/JS minify only // change output location - // rollupOptions: { - // output: { - // manualChunks: undefined, - // assetFileNames: "assets/[name].[ext]", // Output assets (e.g., images, SVGs) to the assets folder - // entryFileNames: "assets/[name].js", // Output entry files (e.g., JavaScript) to the root directory - // chunkFileNames: "assets/[name].[ext]", // Output dynamic imports (chunks) to the assets folder - // }, - // }, + rollupOptions: { + output: { + // manualChunks: undefined, + // assetFileNames: "assets/[name].[ext]", // Output assets (e.g., images, SVGs) to the assets folder + // entryFileNames: "assets/[name].js", // Output entry files (e.g., JavaScript) to the root directory + // chunkFileNames: "assets/[name].[ext]", // Output dynamic imports (chunks) to the assets folder + // Exclude all GIF files from being hashed + assetFileNames: (assetInfo) => { + if (assetInfo.name.endsWith(".gif")) { + return "[name].[ext]"; + } + return `[name].[hash].[ext]`; + }, + }, + }, }, server: {