hookshot/vite.config.mjs

35 lines
901 B
JavaScript
Raw Permalink Normal View History

import { defineConfig } from 'vite'
import preact from '@preact/preset-vite'
import { resolve } from 'path'
import alias from '@rollup/plugin-alias'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [preact()],
root: 'web',
base: '',
optimizeDeps: {
exclude: ['@vector-im/compound-web'],
},
build: {
outDir: '../public',
rollupOptions: {
input: {
main: resolve('web', 'index.html'),
oauth: resolve('web', 'oauth.html'),
},
plugins: [
alias({
entries: [
{ find: 'react', replacement: 'preact/compat' },
{ find: 'react-dom/test-utils', replacement: 'preact/test-utils' },
{ find: 'react-dom', replacement: 'preact/compat' },
{ find: 'react/jsx-runtime', replacement: 'preact/jsx-runtime' }
]
})
]
},
emptyOutDir: true,
},
})