+
๐งช Standalone Vue Apps Test Page
+
Loading...
+
+
+
+
Test 1: Single Component Mount
+
Testing single instance of HeaderOsVersion component
+
+
+
+
+
+
+
+
Test 2: Multiple Component Mounts (Shared Pinia Store)
+
Testing that multiple instances share the same Pinia store
+
+
+
+
+
+
Test 3: Dynamic Component Creation
+
Test dynamically adding components after page load
+
+
+
+
+
+
+
+
+
+
+
Test 4: Modal Components
+
Test modal functionality
+
+
+
+
+ Note: Modals require proper store state to display
+
+
+
+
+
+
Debug Information
+
+ Waiting for initialization...
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/vite.standalone.config.ts b/web/vite.standalone.config.ts
new file mode 100644
index 000000000..a9496c004
--- /dev/null
+++ b/web/vite.standalone.config.ts
@@ -0,0 +1,85 @@
+import { defineConfig } from 'vite';
+import vue from '@vitejs/plugin-vue';
+import path, { resolve } from 'path';
+import fs from 'fs';
+
+// Read CSS content at build time
+const getCssContent = () => {
+ const cssFiles = [
+ '.nuxt/dist/client/_nuxt/entry.DXd6OtrS.css',
+ '.output/public/_nuxt/entry.DXd6OtrS.css',
+ 'assets/main.css'
+ ];
+
+ for (const file of cssFiles) {
+ const fullPath = path.resolve(__dirname, file);
+ if (fs.existsSync(fullPath)) {
+ console.log(`Reading CSS from: ${fullPath}`);
+ return fs.readFileSync(fullPath, 'utf-8');
+ }
+ }
+
+ console.warn('No CSS file found, using empty string');
+ return '';
+};
+
+export default defineConfig({
+ plugins: [
+ vue(),
+ {
+ name: 'inject-css-content',
+ transform(code, id) {
+ // Replace CSS import with actual content
+ if (id.includes('vue-mount-app')) {
+ const cssContent = getCssContent();
+ const replacement = `const tailwindStyles = ${JSON.stringify(cssContent)};`;
+
+ // Replace the import statement
+ code = code.replace(
+ /import tailwindStyles from ['"]~\/assets\/main\.css\?inline['"];?/,
+ replacement
+ );
+
+ return code;
+ }
+ return null;
+ },
+ },
+ ],
+ resolve: {
+ alias: {
+ '~': resolve(__dirname, './'),
+ '@': resolve(__dirname, './'),
+ },
+ },
+ build: {
+ outDir: '.nuxt/standalone-apps',
+ emptyOutDir: true,
+ lib: {
+ entry: resolve(__dirname, 'components/standalone-mount.ts'),
+ name: 'UnraidStandaloneApps',
+ fileName: 'standalone-apps',
+ formats: ['es'],
+ },
+ rollupOptions: {
+ external: [],
+ output: {
+ format: 'es',
+ entryFileNames: 'standalone-apps.js',
+ chunkFileNames: '[name]-[hash].js',
+ assetFileNames: '[name]-[hash][extname]',
+ inlineDynamicImports: false,
+ },
+ },
+ cssCodeSplit: false,
+ minify: 'terser',
+ terserOptions: {
+ mangle: {
+ toplevel: true,
+ },
+ },
+ },
+ define: {
+ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'),
+ },
+});
diff --git a/web/vite.test.config.ts b/web/vite.test.config.ts
new file mode 100644
index 000000000..c49709e97
--- /dev/null
+++ b/web/vite.test.config.ts
@@ -0,0 +1,26 @@
+import { defineConfig } from 'vite';
+import vue from '@vitejs/plugin-vue';
+import { resolve } from 'path';
+
+export default defineConfig({
+ plugins: [vue()],
+ root: '.',
+ server: {
+ port: 5173,
+ open: '/test-standalone.html',
+ cors: true,
+ fs: {
+ strict: false,
+ },
+ },
+ resolve: {
+ alias: {
+ '~': resolve(__dirname, './'),
+ '@': resolve(__dirname, './'),
+ 'vue': 'vue/dist/vue.esm-bundler.js',
+ },
+ },
+ optimizeDeps: {
+ include: ['vue', 'pinia', '@vue/apollo-composable'],
+ },
+});