generated from keycloakify/keycloakify-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
54 lines (52 loc) · 1.95 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import react from "@vitejs/plugin-react";
import { keycloakify } from "keycloakify/vite-plugin";
import { defineConfig } from "vite";
// 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";
import tsconfigPaths from "vite-tsconfig-paths";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
tsconfigPaths(),
commonjs(),
keycloakify({
// See: https://docs.keycloakify.dev/build-options#themename
themeName: "coursemology-keycloakify",
// See: https://docs.keycloakify.dev/environnement-variables
extraThemeProperties: ["MY_ENV_VARIABLE=${env.MY_ENV_VARIABLE:}"],
// 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",
),
);
},
}),
],
/*
* 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/"
build: {
sourcemap: true,
},
});