- Remove MONETIZATION.md and README.md - Add dist/ to gitignore Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import UnoCSS from 'unocss/vite'
|
|
import { resolve } from 'path'
|
|
|
|
export default defineConfig(({ command }) => ({
|
|
plugins: [
|
|
// Only use UnoCSS plugin in dev mode for HMR
|
|
...(command === 'serve' ? [UnoCSS()] : []),
|
|
...(command === 'build' ? [react()] : []),
|
|
],
|
|
base: command === 'serve' ? '/@owner-tools' : '/',
|
|
esbuild: {
|
|
jsxInject: `import React from 'react'`
|
|
},
|
|
resolve: {
|
|
alias: command === 'serve' ? {
|
|
// In dev mode, alias the generated file to virtual:uno.css
|
|
'./uno-generated.css': 'virtual:uno.css',
|
|
} : {},
|
|
},
|
|
|
|
...(command === 'serve' && {
|
|
server: {
|
|
host: true,
|
|
port: 5174,
|
|
strictPort: true,
|
|
allowedHosts: true,
|
|
hmr: {
|
|
clientPort: 80,
|
|
path: '/@owner-tools'
|
|
},
|
|
proxy: {
|
|
'/api/studio': {
|
|
target: 'http://app:8080',
|
|
changeOrigin: true
|
|
}
|
|
}
|
|
}
|
|
}),
|
|
|
|
build: {
|
|
lib: {
|
|
entry: resolve(__dirname, 'src/main.tsx'),
|
|
name: 'OwnerTools',
|
|
formats: ['iife'],
|
|
fileName: () => 'owner-tools.js'
|
|
},
|
|
outDir: '../../internal/tenant/assets/js',
|
|
emptyOutDir: false,
|
|
}
|
|
}))
|