Skip to content

Commit

Permalink
cssnano imported an used directly
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmanueldaza committed Dec 26, 2024
1 parent 0c69ce1 commit 67ab581
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
import cssnano from "cssnano";

export default defineConfig({
plugins: [react()],
Expand Down Expand Up @@ -43,16 +44,12 @@ export default defineConfig({
"./src/components/slideshow/Thumbnails.tsx",
],
},

// Asset naming strategy
entryFileNames: "assets/[name].[hash].js",
chunkFileNames: "assets/[name].[hash].js",
assetFileNames: ({ name }) => {
// Keep images in separate directory
if (/\.(gif|jpe?g|png|svg|webp)$/.test(name ?? "")) {
return "assets/images/[name].[hash][extname]";
}
// Keep CSS in separate directory
if (/\.css$/.test(name ?? "")) {
return "assets/css/[name].[hash][extname]";
}
Expand Down Expand Up @@ -84,7 +81,7 @@ export default defineConfig({
postcss: {
plugins: [
process.env.NODE_ENV === "production"
? require("cssnano")({ preset: "default" })
? cssnano({ preset: "default" })
: null,
].filter(Boolean),
},
Expand Down

0 comments on commit 67ab581

Please sign in to comment.