uikit/vite.config.js
2026-06-17 14:20:19 +03:30

60 lines
1.3 KiB
JavaScript

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
const externalPackages = [
"react",
"react-dom",
"react/jsx-runtime",
"@chakra-ui/react",
"@emotion/react",
"@emotion/styled",
"framer-motion",
"keycloak-js",
"axios",
"@tanstack/react-query",
"@tanstack/react-table",
"react-icons",
"react-hook-form",
];
export default defineConfig({
plugins: [react()],
build: {
lib: {
entry: {
index: path.resolve(process.cwd(), "src/index.js"),
utils: path.resolve(process.cwd(), "src/utils/index.js"),
pagination: path.resolve(process.cwd(), "src/pagination/index.js"),
layout: path.resolve(process.cwd(), "src/layout/index.js"),
core: path.resolve(process.cwd(), "src/core/index.js"),
table: path.resolve(process.cwd(), "src/table/index.js"),
form: path.resolve(process.cwd(), "src/form/index.js"),
},
formats: ["es"],
},
rollupOptions: {
external: (id) => {
return (
externalPackages.includes(id) ||
id.startsWith("react-icons/") ||
id.startsWith("@emotion/")
);
},
output: {
entryFileNames: "[name].js",
chunkFileNames: "chunks/[name]-[hash].js",
assetFileNames: "assets/[name]-[hash][extname]",
},
},
},
});