@@ -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+
5048let 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/
105120export 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