2025-08-13 03:21:24 +08:00
|
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
|
|
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
|
|
|
|
import viteReact from '@vitejs/plugin-react';
|
|
|
|
import { defineConfig } from 'vite';
|
2025-08-13 04:07:06 +08:00
|
|
|
import checker from 'vite-plugin-checker';
|
2025-08-13 03:21:24 +08:00
|
|
|
import viteTsConfigPaths from 'vite-tsconfig-paths';
|
2025-08-12 11:28:36 +08:00
|
|
|
|
2025-08-15 01:59:13 +08:00
|
|
|
const config = defineConfig(({ command, mode }) => {
|
|
|
|
const isBuild = command === 'build';
|
2025-08-16 03:38:57 +08:00
|
|
|
const isProduction = mode === 'production';
|
|
|
|
const isTypecheck = process.argv.includes('--typecheck') || process.env.TYPECHECK === 'true';
|
|
|
|
const useChecker = !process.env.VITEST && isBuild;
|
2025-09-03 01:16:56 +08:00
|
|
|
const isLocalBuild = process.env.VITE_PUBLIC_API2_URL?.includes('127.0.0.1');
|
|
|
|
console.log('isLocalBuild', isLocalBuild, process.env.VITE_PUBLIC_API2_URL);
|
2025-08-15 01:59:13 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
server: { port: 3000 },
|
|
|
|
plugins: [
|
|
|
|
// this is the plugin that enables path aliases
|
|
|
|
viteTsConfigPaths({ projects: ['./tsconfig.json'] }),
|
|
|
|
tailwindcss(),
|
2025-09-03 03:04:52 +08:00
|
|
|
tanstackStart({ customViteReactPlugin: true, target: 'cloudflare-module' }),
|
2025-08-15 01:59:13 +08:00
|
|
|
viteReact(),
|
|
|
|
],
|
|
|
|
};
|
2025-08-12 11:28:36 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
export default config;
|