keycloak-theme-react/vite.config.ts

58 lines
1.9 KiB
TypeScript
Raw Normal View History

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// NOTE: This is just for the Keycloakify core contributors to be able to dynamically link
// to a local version of the keycloakify package. This is not needed for normal usage.
import commonjs from "vite-plugin-commonjs";
2024-02-12 01:00:54 +00:00
import { keycloakify } from "keycloakify/vite-plugin";
2024-02-23 19:10:39 +00:00
// https://vitejs.dev/config/
export default defineConfig({
2024-02-01 03:50:06 +00:00
plugins: [
react(),
commonjs(),
2024-02-23 19:10:39 +00:00
keycloakify({
// See: https://docs.keycloakify.dev/build-options#themename
2024-02-23 19:10:39 +00:00
themeName: "keycloakify-starter",
// See: https://docs.keycloakify.dev/environnement-variables
2024-02-23 19:10:39 +00:00
extraThemeProperties: [
"MY_ENV_VARIABLE=${env.MY_ENV_VARIABLE:}"
2024-02-23 19:10:39 +00:00
],
// This is a hook that will be called after the build is done
// but before the jar is created.
// You can use it to add/remove/edit your theme files.
postBuild: async keycloakifyBuildOptions => {
const fs = await import("fs/promises");
const path = await import("path");
await fs.writeFile(
path.join(keycloakifyBuildOptions.keycloakifyBuildDirPath, "foo.txt"),
Buffer.from(
[
"This file was created by the postBuild hook of the keycloakify vite plugin",
"",
"Resolved keycloakifyBuildOptions:",
"",
JSON.stringify(keycloakifyBuildOptions, null, 2),
""
].join("\n"),
"utf8"
)
);
}
})
2024-02-13 01:36:56 +00:00
],
/*
* Uncomment this if you want to use the default domain provided by GitHub Pages
* replace "keycloakify-starter" with your repository name.
* This is only relevent if you are building an Wep App + A Keycloak theme.
* If you are only building a Keycloak theme, you can ignore this.
*/
//base: "/keycloakify-starter/"
2024-02-24 04:17:46 +00:00
build: {
sourcemap: true
}
})