// dweb.config.ts
import type { AppConfig } from 'jsr:@dreamer/dweb';
import { tailwind, cors } from 'jsr:@dreamer/dweb';
const config: AppConfig = {
name: 'my-app',
renderMode: 'hybrid', // 'ssr' | 'csr' | 'hybrid'
// 服务器配置
server: {
port: 3000,
host: 'localhost',
},
// 路由配置
routes: {
dir: 'routes',
ignore: ['**/*.test.ts', '**/*.test.tsx'],
},
// Cookie 配置
cookie: {
secret: 'your-secret-key-here-change-in-production',
},
// Session 配置
session: {
secret: 'your-session-secret-here-change-in-production',
store: 'memory',
maxAge: 3600000, // 1小时
secure: false,
httpOnly: true,
},
// 插件配置
plugins: [
tailwind({
version: 'v4',
cssPath: 'assets/style.css',
optimize: true,
}),
],
// 中间件配置
middleware: [
cors({
origin: '*',
methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],
allowedHeaders: ['Content-Type', 'Authorization'],
}),
],
// 开发配置
dev: {
hmrPort: 24678,
reloadDelay: 300,
},
// 构建配置
build: {
outDir: 'dist',
},
};
export default config;