43 lines
848 B
JavaScript
43 lines
848 B
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",
|
|
|
|
"keycloak-js",
|
|
"axios",
|
|
|
|
"@tanstack/react-query",
|
|
"@tanstack/react-table",
|
|
|
|
"react-icons",
|
|
];
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
build: {
|
|
lib: {
|
|
entry: {
|
|
index: path.resolve(process.cwd(), "src/index.js"),
|
|
table: path.resolve(process.cwd(), "src/table/index.js"),
|
|
},
|
|
formats: ["es"],
|
|
},
|
|
rollupOptions: {
|
|
external: (id) => {
|
|
return externalPackages.includes(id) || id.startsWith("react-icons/");
|
|
},
|
|
output: {
|
|
entryFileNames: "[name].js",
|
|
chunkFileNames: "chunks/[name]-[hash].js",
|
|
},
|
|
},
|
|
},
|
|
});
|