Files
project-behind-the-desk/vite.config.js
T

41 lines
816 B
JavaScript

import { defineConfig } from 'vite';
import path from 'path';
import { glob } from 'glob';
import { fileURLToPath } from 'url';
export default defineConfig({
root: './',
build: {
outDir: 'dist',
rollupOptions: {
input: Object.fromEntries(
glob.sync('*.html').map(file => [
path.basename(file, path.extname(file)),
fileURLToPath(new URL(file, import.meta.url))
])
)
}
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
host: '0.0.0.0',
port: 5173,
open: false,
},
plugins: [
{
name: 'html-transform',
transformIndexHtml(html) {
return html.replace(
/<title>(.*?)<\/title>/,
'<title>Behind the Desk</title>'
);
},
},
],
});