From 8f2a03e21e7e5738b020d9605995ede8a0f962cb Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Thu, 9 Oct 2025 23:53:34 -0400 Subject: [PATCH] nx fix vite build (#872) --- frontend/apps/editor3d/package.json | 3 ++- .../components/login-modal/vite.config.ts | 8 ++++++- .../promptbox/src/lib/PromptBox2D.tsx | 3 +-- .../promptbox/src/lib/PromptBox3D.tsx | 5 +---- .../promptbox/src/lib/PromptBoxImage.tsx | 6 +++--- .../libs/components/toaster/vite.config.ts | 21 +++++++++++++++++-- frontend/libs/tauri-events/vite.config.ts | 15 +++++++++++-- frontend/package-lock.json | 1 + frontend/tsconfig.json | 12 +++++------ 9 files changed, 53 insertions(+), 21 deletions(-) diff --git a/frontend/apps/editor3d/package.json b/frontend/apps/editor3d/package.json index 7b87344f5c..b3a70b66e4 100644 --- a/frontend/apps/editor3d/package.json +++ b/frontend/apps/editor3d/package.json @@ -17,7 +17,7 @@ "build": "vite build", "preview": "vite preview --port 8080", "dev": "echo 'editor3d' && vite dev", - "production-preview": "echo 'editor3d dev with production preview' && vite build && vite preview --port 5173", + "production-preview": "echo 'editor3d dev with production preview' && vite build --debug --emptyOutDir --logLevel info && vite preview --port 5173", "staging-build": "vite build", "lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint playground/* .", "typecheck": "tsc", @@ -65,6 +65,7 @@ "react-dom": "^18.2.0", "react-drag-drop-files": "^2.3.10", "react-helmet": "^6.1.0", + "react-hot-toast": "^2.5.2", "react-image-crop": "^11.0.5", "react-konva": "^18.2.10", "react-router": "^6.26.1", diff --git a/frontend/libs/components/login-modal/vite.config.ts b/frontend/libs/components/login-modal/vite.config.ts index 98ac28b77a..22771d6129 100644 --- a/frontend/libs/components/login-modal/vite.config.ts +++ b/frontend/libs/components/login-modal/vite.config.ts @@ -7,7 +7,13 @@ import * as path from 'path'; export default defineConfig(() => ({ root: __dirname, cacheDir: '../../../node_modules/.vite/libs/components/login-modal', - plugins: [react(), dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })], + plugins: [ + react(), + dts({ + entryRoot: 'src', + tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') + }) + ], // Uncomment this if you are using workers. // worker: { // plugins: [ nxViteTsPaths() ], diff --git a/frontend/libs/components/promptbox/src/lib/PromptBox2D.tsx b/frontend/libs/components/promptbox/src/lib/PromptBox2D.tsx index 78d3f5e9de..00b6a3b591 100644 --- a/frontend/libs/components/promptbox/src/lib/PromptBox2D.tsx +++ b/frontend/libs/components/promptbox/src/lib/PromptBox2D.tsx @@ -5,7 +5,6 @@ import { JobContextType, MaybeCanvasRenderBitmapType, UploaderState, - UploaderStates, } from "@storyteller/common"; import { PopoverMenu, PopoverItem } from "@storyteller/ui-popover"; import { Tooltip } from "@storyteller/ui-tooltip"; @@ -32,7 +31,7 @@ import { EnqueueContextualEditImage, EnqueueContextualEditImageSize, } from "@storyteller/tauri-api"; -import { usePrompt2DStore, RefImage } from "./promptStore"; +import { usePrompt2DStore } from "./promptStore"; import { gtagEvent } from "@storyteller/google-analytics"; import { getCapabilitiesForModel } from "@storyteller/model-list"; import { ImageModel } from "@storyteller/model-list"; diff --git a/frontend/libs/components/promptbox/src/lib/PromptBox3D.tsx b/frontend/libs/components/promptbox/src/lib/PromptBox3D.tsx index 5d04e5d25c..4e4edf00ba 100644 --- a/frontend/libs/components/promptbox/src/lib/PromptBox3D.tsx +++ b/frontend/libs/components/promptbox/src/lib/PromptBox3D.tsx @@ -39,11 +39,8 @@ import { Signal } from "@preact/signals-react"; import { CommandSuccessStatus, EnqueueContextualEditImage, - EnqueueContextualEditImageModel, EnqueueContextualEditImageSize, - // waitForSoraLogin, } from "@storyteller/tauri-api"; -// import { showActionReminder } from "@storyteller/ui-action-reminder-modal"; import { usePrompt3DStore } from "./promptStore"; import { gtagEvent } from "@storyteller/google-analytics"; import { ImageModel } from "@storyteller/model-list"; @@ -98,7 +95,7 @@ export const PromptBox3D = ({ snapshotCurrentFrame, }: PromptBox3DProps) => { useSignals(); - const fileInputRef = useRef(null); + //const fileInputRef = useRef(null); const textareaRef = useRef(null); const [content, setContent] = useState(null); const [isModalOpen, setIsModalOpen] = useState(false); diff --git a/frontend/libs/components/promptbox/src/lib/PromptBoxImage.tsx b/frontend/libs/components/promptbox/src/lib/PromptBoxImage.tsx index 3fa6c4793e..46270ca202 100644 --- a/frontend/libs/components/promptbox/src/lib/PromptBoxImage.tsx +++ b/frontend/libs/components/promptbox/src/lib/PromptBoxImage.tsx @@ -235,8 +235,8 @@ export const PromptBoxImage = ({ return; } - console.log("Selected model:", selectedModel) - console.log("Prompt:", prompt) + console.debug("Selected model:", selectedModel) + console.debug("Prompt:", prompt) setIsEnqueueing(true); @@ -274,7 +274,7 @@ export const PromptBoxImage = ({ } const generateResponse = await EnqueueTextToImage(request); - console.log("PromptBoxImage - generateResponse", generateResponse); + console.debug("PromptBoxImage - generateResponse", generateResponse); await onEnqueuePressed?.(prompt, generationCount, subscriberId); } catch (err) { diff --git a/frontend/libs/components/toaster/vite.config.ts b/frontend/libs/components/toaster/vite.config.ts index a0453aa36a..ff0ab33a7a 100644 --- a/frontend/libs/components/toaster/vite.config.ts +++ b/frontend/libs/components/toaster/vite.config.ts @@ -7,7 +7,13 @@ import * as path from 'path'; export default defineConfig(() => ({ root: __dirname, cacheDir: '../../../node_modules/.vite/libs/components/toaster', - plugins: [react(), dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })], + plugins: [ + react(), + dts({ + entryRoot: 'src', + tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') + }) + ], // Uncomment this if you are using workers. // worker: { // plugins: [ nxViteTsPaths() ], @@ -32,7 +38,18 @@ export default defineConfig(() => ({ }, rollupOptions: { // External packages that should not be bundled into your library. - external: ['react','react-dom','react/jsx-runtime'] + external: [ + 'react', + 'react-dom', + 'react/jsx-runtime', + 'react-hot-toast' + ], + output: { + globals: { + 'react-hot-toast': 'react-hot-toast', + }, + preserveModules: false, + }, }, }, test: { diff --git a/frontend/libs/tauri-events/vite.config.ts b/frontend/libs/tauri-events/vite.config.ts index 8d63ad899b..f88571a3db 100644 --- a/frontend/libs/tauri-events/vite.config.ts +++ b/frontend/libs/tauri-events/vite.config.ts @@ -7,7 +7,13 @@ import * as path from 'path'; export default defineConfig(() => ({ root: __dirname, cacheDir: '../../node_modules/.vite/libs/tauri-events', - plugins: [react(), dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })], + plugins: [ + react(), + dts({ + entryRoot: 'src', + tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') + }) + ], // Uncomment this if you are using workers. // worker: { // plugins: [ nxViteTsPaths() ], @@ -32,7 +38,12 @@ export default defineConfig(() => ({ }, rollupOptions: { // External packages that should not be bundled into your library. - external: ['react','react-dom','react/jsx-runtime'] + external: [ + 'react', + 'react-dom', + 'react/jsx-runtime', + 'react-hot-toast', + ] }, }, test: { diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 2d5bd7fc79..12eae9c690 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -206,6 +206,7 @@ "react-dom": "^18.2.0", "react-drag-drop-files": "^2.3.10", "react-helmet": "^6.1.0", + "react-hot-toast": "^2.5.2", "react-image-crop": "^11.0.5", "react-konva": "^18.2.10", "react-router": "^6.26.1", diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 291c3c3411..7d757bc973 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -39,6 +39,12 @@ { "path": "./libs/components/tooltip" }, + { + "path": "./libs/tauri-api" + }, + { + "path": "./libs/tauri-events" + }, { "path": "./libs/tauri-utils" }, @@ -78,9 +84,6 @@ { "path": "./libs/common" }, - { - "path": "./libs/tauri-api" - }, { "path": "./libs/components/login-modal" }, @@ -150,9 +153,6 @@ { "path": "./libs/analytics/google-analytics" }, - { - "path": "./libs/tauri-events" - }, { "path": "./libs/components/provider-setup-modal" },