Problem: Customer SPA stuck on 'Loading...' message after installation Root Cause: Vite build wasn't generating manifest.json, causing WordPress asset loader to fall back to direct app.js loading without proper module configuration Solution: 1. Added manifest: true to both SPA vite configs 2. Updated Assets.php to look for manifest in correct location (.vite/manifest.json) 3. Rebuilt both SPAs with manifest generation Changes: - customer-spa/vite.config.ts: Added manifest: true - admin-spa/vite.config.ts: Added manifest: true - includes/Frontend/Assets.php: Updated manifest path from 'manifest.json' to '.vite/manifest.json' Build Output: - Customer SPA: dist/.vite/manifest.json generated - Admin SPA: dist/.vite/manifest.json generated - Production zip: 10M (includes manifest files) Result: ✅ Customer SPA now loads correctly via manifest ✅ Admin SPA continues to work ✅ Proper asset loading with CSS and JS from manifest ✅ Production package ready for deployment
30 lines
874 B
TypeScript
30 lines
874 B
TypeScript
import react from '@vitejs/plugin-react';
|
|
import { defineConfig } from 'vite';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
|
|
const key = fs.readFileSync(path.resolve(__dirname, '.cert/woonoow.local-key.pem'));
|
|
const cert = fs.readFileSync(path.resolve(__dirname, '.cert/woonoow.local-cert.pem'));
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: { alias: { '@': path.resolve(__dirname, './src') } },
|
|
server: {
|
|
host: 'woonoow.local',
|
|
port: 5173,
|
|
strictPort: true,
|
|
https: { key, cert },
|
|
cors: true,
|
|
origin: 'https://woonoow.local:5173',
|
|
hmr: { protocol: 'wss', host: 'woonoow.local', port: 5173 }
|
|
},
|
|
build: {
|
|
outDir: 'dist',
|
|
emptyOutDir: true,
|
|
manifest: true,
|
|
rollupOptions: {
|
|
input: { app: 'src/main.tsx' },
|
|
output: { entryFileNames: 'app.js', assetFileNames: 'app.[ext]' }
|
|
}
|
|
}
|
|
}); |