keycloak-scim/js/apps/account-ui/vite.config.ts
Erik Jan de Wit 5d39625d82
account library (#26373)
* initial version

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* better init

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* added more components

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* moved to public

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* use environment var to enter library mode

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* added export field

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

---------

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
2024-02-01 16:46:11 +01:00

36 lines
897 B
TypeScript

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