Skip to content

Commit 70ff0b8

Browse files
committed
serve correct index oidc
1 parent 4a02ae0 commit 70ff0b8

File tree

2 files changed

+20
-27
lines changed

2 files changed

+20
-27
lines changed

swift_browser_ui_frontend/src/index_oidc.html

Lines changed: 0 additions & 24 deletions
This file was deleted.

swift_browser_ui_frontend/vite.config.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ let pages = {
4444
"login": path.resolve(root, "login.html"),
4545
"login2step": path.resolve(root, "login2step.html"),
4646
};
47-
if (oidcEnabled) {
48-
pages["index"] = path.resolve(root, "index_oidc.html");
49-
}
47+
5048
let proxy = {
5149
"/static/assets": proxyTo,
5250
"/api": proxyTo,
@@ -101,6 +99,23 @@ const multipagePlugin = () => ({
10199
},
102100
});
103101

102+
const htmlPlugin = (oidc) => {
103+
if (oidc) {
104+
return {
105+
name: "html-transform",
106+
transformIndexHtml: {
107+
enforce: "pre",
108+
transform: (html, {path}) => {
109+
if (path.endsWith("index.html")) {
110+
return html.replace("index.js", "index_oidc.js");
111+
}
112+
}
113+
},
114+
}
115+
}
116+
117+
};
118+
104119
// https://vitejs.dev/config/
105120
export default defineConfig(({ command, mode }) => {
106121

@@ -127,6 +142,7 @@ export default defineConfig(({ command, mode }) => {
127142
}
128143
let base = undefined;
129144
if (command === "build") base = "/static/";
145+
130146

131147
return {
132148
root,
@@ -143,6 +159,7 @@ export default defineConfig(({ command, mode }) => {
143159
}),
144160
multipagePlugin(),
145161
VueI18nPlugin(),
162+
htmlPlugin(oidcEnabled)
146163
],
147164
build: {
148165
outDir: path.resolve(__dirname, "dist"),

0 commit comments

Comments
 (0)