import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { defineConfig, type Plugin } from 'vite'; import react from '@vitejs/plugin-react'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); /** * Vite 6 can add `crossorigin` to the module script and CSS. In Qortal Hub, that uses a * CORS-style fetch; some hosts do not return ACAO, so the JS never executes and the UI stays on * the static "Loading" placeholder. Strip it for typical same-origin Q-App trees. * Move the app entry to the end of
(after ./zip-store.js) so the IIFE is defined first. */ function qAppHtmlPost(): Plugin { return { name: 'qapp-html', transformIndexHtml: { order: 'post', handler(html) { let h = html.replace(/\s+crossorigin(?:=[^\s>]*)?/gi, ''); const re = /