Skip to content

Commit 1bcc116

Browse files
committed
serve correct index oidc
1 parent 705b58b commit 1bcc116

File tree

2 files changed

+17
-27
lines changed

2 files changed

+17
-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: 17 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,20 @@ const multipagePlugin = () => ({
10199
},
102100
});
103101

102+
const htmlPlugin = (oidc) => {
103+
if (oidc) {
104+
return {
105+
name: "html-transform",
106+
transformIndexHtml: {
107+
enforce: "pre",
108+
apply: 'build',
109+
transform: (html) => html.replace('index.js', 'index_oidc.js',)
110+
},
111+
}
112+
}
113+
114+
};
115+
104116
// https://vitejs.dev/config/
105117
export default defineConfig(({ command, mode }) => {
106118

@@ -127,6 +139,7 @@ export default defineConfig(({ command, mode }) => {
127139
}
128140
let base = undefined;
129141
if (command === "build") base = "/static/";
142+
130143

131144
return {
132145
root,
@@ -143,6 +156,7 @@ export default defineConfig(({ command, mode }) => {
143156
}),
144157
multipagePlugin(),
145158
VueI18nPlugin(),
159+
htmlPlugin(oidcEnabled)
146160
],
147161
build: {
148162
outDir: path.resolve(__dirname, "dist"),

0 commit comments

Comments
 (0)