✨
This commit is contained in:
40
vite.config.ts
Normal file
40
vite.config.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import path from "path";
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react-swc";
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
envDir: path.resolve(".", "env"),
|
||||
plugins: [react()],
|
||||
css: {
|
||||
modules: {
|
||||
localsConvention: "camelCase",
|
||||
},
|
||||
},
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: (id) => {
|
||||
if (id.includes("node_modules")) {
|
||||
if (id.includes("react")) {
|
||||
return "react";
|
||||
} else {
|
||||
return "vendors";
|
||||
}
|
||||
}
|
||||
return;
|
||||
},
|
||||
chunkFileNames: (chunkFileInfo) => {
|
||||
for (const id of chunkFileInfo.moduleIds) {
|
||||
const match = id.match(/\/pages\/([^/]+)/);
|
||||
if (match) {
|
||||
return `js/${match[1].toLocaleLowerCase()}-[hash].js`;
|
||||
}
|
||||
}
|
||||
|
||||
return "js/[name]-[hash].js";
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user