- Add cannaiq_enabled column to businesses table - Add CRM account edit and contacts-edit views - Enhance quote creation with improved contact selection - Update search controller with additional functionality - Add buyer businesses seeder for dev environment - UI improvements to promotions, invoices, and sidebar
56 lines
2.0 KiB
JavaScript
56 lines
2.0 KiB
JavaScript
import { defineConfig, loadEnv } from "vite";
|
|
import laravel from "laravel-vite-plugin";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
// Load env file based on `mode` in the current working directory
|
|
const env = loadEnv(mode, process.cwd(), '');
|
|
|
|
// Extract hostname from APP_URL or VITE_DEV_SERVER_URL
|
|
const appUrl = env.APP_URL || 'http://localhost';
|
|
const viteDevUrl = env.VITE_DEV_SERVER_URL || '';
|
|
|
|
// Parse hostname from APP_URL (e.g., "http://order-flow-updates.cannabrands.test" -> "order-flow-updates.cannabrands.test")
|
|
const appHost = appUrl.replace(/^https?:\/\//, '').split(':')[0];
|
|
const appOrigin = appUrl.replace(/\/$/, ''); // Full origin with port for CORS (e.g., http://localhost:8080)
|
|
const viteHost = viteDevUrl ? viteDevUrl.replace(/^https?:\/\//, '').split(':')[0] : `vite.${appHost}`;
|
|
|
|
// Use full VITE_DEV_SERVER_URL if provided, otherwise construct from hostname
|
|
const viteOrigin = viteDevUrl || `http://${viteHost}`;
|
|
|
|
return {
|
|
plugins: [
|
|
tailwindcss(),
|
|
laravel({
|
|
input: ["resources/css/app.css", "resources/js/app.js"],
|
|
refresh: true,
|
|
}),
|
|
],
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: parseInt(env.VITE_PORT || '5173'),
|
|
strictPort: true,
|
|
origin: viteOrigin,
|
|
cors: {
|
|
origin: [
|
|
appOrigin, // Full origin with port (e.g., http://localhost:8080)
|
|
viteOrigin,
|
|
'http://localhost:8000', // Sail default port
|
|
'http://localhost',
|
|
'http://127.0.0.1:8000',
|
|
],
|
|
credentials: true,
|
|
},
|
|
hmr: {
|
|
host: viteHost,
|
|
protocol: 'ws',
|
|
},
|
|
allowedHosts: [
|
|
viteHost,
|
|
appHost,
|
|
'.cannabrands.test',
|
|
],
|
|
},
|
|
};
|
|
});
|