keycloak-scim/js/apps/account-ui/vite.config.ts
Jon Koops 7afd75ba08
Use browser router for Account Console (#22192)
Closes #27442

Signed-off-by: Jon Koops <jonkoops@gmail.com>
2024-03-04 12:38:28 +00:00

45 lines
1.1 KiB
TypeScript

import react from "@vitejs/plugin-react-swc";
import path from "path";
import { defineConfig, loadEnv } from "vite";
import { checker } from "vite-plugin-checker";
import dts from "vite-plugin-dts";
import { getRootPath } from "./src/utils/getRootPath";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
const external = ["react", "react/jsx-runtime", "react-dom"];
const plugins = [react(), checker({ typescript: true })];
if (env.LIB) {
external.push("react-router-dom");
external.push("react-i18next");
plugins.push(dts({ insertTypesEntry: true }));
}
const lib = env.LIB
? {
lib: {
entry: path.resolve(__dirname, "src/index.ts"),
formats: ["es"],
},
}
: undefined;
return {
base: "",
server: {
port: 8080,
open: getRootPath(),
},
build: {
...lib,
sourcemap: true,
target: "esnext",
modulePreload: false,
cssMinify: "lightningcss",
rollupOptions: {
external: external,
},
},
plugins,
};
});