diff --git a/frontend/common/package.json b/frontend/common/package.json index a876539..ff12aac 100644 --- a/frontend/common/package.json +++ b/frontend/common/package.json @@ -2,11 +2,12 @@ "name": "@ra-aid/common", "version": "1.0.0", "private": true, - "main": "dist/index.js", - "types": "dist/index.d.ts", + "main": "src/index.ts", + "types": "src/index.ts", "scripts": { "build": "tsc && postcss src/styles/global.css -o dist/styles/global.css", - "dev": "concurrently \"tsc --watch\" \"postcss src/styles/global.css -o dist/styles/global.css --watch\"" + "dev": "concurrently \"tsc --watch\" \"postcss src/styles/global.css -o dist/styles/global.css --watch\"", + "prepare": "npm run build" }, "dependencies": { "@radix-ui/react-collapsible": "^1.1.3", diff --git a/frontend/common/src/index.ts b/frontend/common/src/index.ts index e47a3fc..6a63b0c 100644 --- a/frontend/common/src/index.ts +++ b/frontend/common/src/index.ts @@ -18,9 +18,6 @@ export * from './components/TimelineFeed'; export * from './components/SessionDrawer'; export * from './components/SessionSidebar'; -// Export the main screen component -export * from './components/DefaultAgentScreen'; - // Export the hello function (temporary example) export const hello = (): void => { console.log("Hello from @ra-aid/common"); diff --git a/frontend/web/vite.config.js b/frontend/web/vite.config.js index 6517ea5..082859f 100644 --- a/frontend/web/vite.config.js +++ b/frontend/web/vite.config.js @@ -3,23 +3,44 @@ import react from '@vitejs/plugin-react'; import path from 'path'; export default defineConfig({ - plugins: [react()], + plugins: [ + react(), + ], resolve: { - // Ensure that Vite treats symlinked packages as local, so HMR works correctly. + // Point to the source files instead of dist for development alias: { - '@ra-aid/common': path.resolve(__dirname, '../common/dist') + '@ra-aid/common': path.resolve(__dirname, '../common/src') + } + }, + optimizeDeps: { + // Force Vite to include these dependencies in its optimization + include: ['@ra-aid/common'], + // Tell Vite to respect our aliased packages instead of using node_modules for them + esbuildOptions: { + preserveSymlinks: true, } }, server: { + hmr: { + // More verbose logging for HMR + overlay: true, + }, watch: { - // Watch for changes in the common package. - // This pattern forces Vite to notice file changes in the shared library. - paths: ['../common/src/**', '../common/dist/**'] + // Watch for changes in the common package + paths: ['../common/src/**'], + // Ensure changes in source files trigger a reload + usePolling: true, } }, css: { // PostCSS configuration is loaded from postcss.config.js // This ensures proper processing of Tailwind directives devSourcemap: true, + }, + build: { + // When building for production, we need to make sure the common package is built too + commonjsOptions: { + transformMixedEsModules: true, + }, } }); \ No newline at end of file