85 lines
2.3 KiB
JavaScript
85 lines
2.3 KiB
JavaScript
import { defineConfig } from 'vite';
|
|
import vue from '@vitejs/plugin-vue';
|
|
import { resolve } from 'path';
|
|
|
|
// https://vitejs.dev/config/
|
|
import path from 'path';
|
|
import fs from 'fs';
|
|
|
|
function injectMetaTags() {
|
|
const template = fs.readFileSync(path.resolve('./src/meta-tags-header.html'));
|
|
|
|
const templates = [
|
|
resolve('activation.html'),
|
|
resolve('filemanager.html'),
|
|
resolve('index.html'),
|
|
resolve('proxyauth.html'),
|
|
resolve('oidc_login.html'),
|
|
resolve('oidc_error.html'),
|
|
resolve('oidc_interaction_confirm.html'),
|
|
resolve('oidc_interaction_abort.html'),
|
|
resolve('logs.html'),
|
|
resolve('passwordreset.html'),
|
|
resolve('restore.html'),
|
|
resolve('setup.html'),
|
|
resolve('setupaccount.html'),
|
|
resolve('terminal.html'),
|
|
];
|
|
|
|
let config;
|
|
|
|
return {
|
|
name: 'inject-meta-tags',
|
|
configResolved(resolvedConfig) {
|
|
config = resolvedConfig;
|
|
},
|
|
transformIndexHtml: {
|
|
handler: function transform(html, ctx) {
|
|
if (!config.isProduction) return html;
|
|
if (templates.indexOf(ctx.filename) === -1) return html;
|
|
|
|
html = html.replace(/<head(.*)>/i, `$&\n${template}`);
|
|
|
|
return html;
|
|
}
|
|
},
|
|
};
|
|
}
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
injectMetaTags(),
|
|
],
|
|
server: {
|
|
fs: {
|
|
// Allow serving files from one level up to the project root for monaco editor assets
|
|
allow: [ '../../../' ]
|
|
},
|
|
},
|
|
// https://vitejs.dev/guide/build.html#multi-page-app
|
|
build: {
|
|
rollupOptions: {
|
|
input: {
|
|
activation: resolve('activation.html'),
|
|
appstatus: resolve('appstatus.html'),
|
|
authcallback: resolve('authcallback.html'),
|
|
filemanager: resolve('filemanager.html'),
|
|
index: resolve('index.html'),
|
|
proxyauth: resolve('proxyauth.html'),
|
|
oidc_login: resolve('oidc_login.html'),
|
|
oidc_error: resolve('oidc_error.html'),
|
|
oidc_interaction_confirm: resolve('oidc_interaction_confirm.html'),
|
|
oidc_interaction_abort: resolve('oidc_interaction_abort.html'),
|
|
logs: resolve('logs.html'),
|
|
notfound: resolve('notfound.html'),
|
|
passwordreset: resolve('passwordreset.html'),
|
|
restore: resolve('restore.html'),
|
|
setup: resolve('setup.html'),
|
|
setupaccount: resolve('setupaccount.html'),
|
|
terminal: resolve('terminal.html'),
|
|
},
|
|
},
|
|
},
|
|
});
|