diff --git a/index.html b/index.html index 8a8b65d0..64f3d3b8 100644 --- a/index.html +++ b/index.html @@ -5,20 +5,10 @@ Powerhouse Connect + %VITE_IMPORT_REACT_SCRIPT%
- - + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 1e3747df..68f24ef0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@powerhousedao/connect", - "version": "1.0.0-dev.149", + "version": "1.0.0-dev.150", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@powerhousedao/connect", - "version": "1.0.0-dev.149", + "version": "1.0.0-dev.150", "license": "AGPL-3.0-only", "dependencies": { "commander": "^12.1.0", @@ -28,7 +28,7 @@ "@electron-forge/publisher-electron-release-server": "^6.2.1", "@electron-forge/publisher-github": "^7.2.0", "@playwright/test": "^1.41.2", - "@powerhousedao/design-system": "^1.4.0", + "@powerhousedao/design-system": "latest", "@powerhousedao/scalars": "latest", "@semantic-release/changelog": "^6.0.3", "@semantic-release/git": "^10.0.1", @@ -101,6 +101,7 @@ "@rollup/rollup-linux-x64-musl": "4.14.3" }, "peerDependencies": { + "@powerhousedao/design-system": "latest", "@powerhousedao/scalars": "latest" } }, diff --git a/package.json b/package.json index a26c0cbc..9e98506b 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,8 @@ "vite-envs": "^4.4.5" }, "peerDependencies": { - "@powerhousedao/scalars": "latest" + "@powerhousedao/scalars": "latest", + "@powerhousedao/design-system": "latest" }, "devDependencies": { "@commitlint/cli": "^18.4.3", @@ -63,7 +64,7 @@ "@electron-forge/publisher-electron-release-server": "^6.2.1", "@electron-forge/publisher-github": "^7.2.0", "@playwright/test": "^1.41.2", - "@powerhousedao/design-system": "^1.4.0", + "@powerhousedao/design-system": "latest", "@powerhousedao/scalars": "latest", "@semantic-release/changelog": "^6.0.3", "@semantic-release/git": "^10.0.1", diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index bfed7df5..63cba233 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -4,6 +4,7 @@ type ImportMetaEnv = { // Auto-generated by `npx vite-envs update-types` and hot-reloaded by the `vite-env` plugin // You probably want to add `/src/vite-env.d.ts` to your .prettierignore + VITE_IMPORT_REACT_SCRIPT: string BASE_URL: string MODE: string DEV: boolean diff --git a/studio/server.ts b/studio/server.ts index c6a58cff..b891165c 100644 --- a/studio/server.ts +++ b/studio/server.ts @@ -71,12 +71,20 @@ export async function startServer() { resolve: { alias: { // Resolve to the node_modules in the project root + '@powerhousedao/design-system': join( + projectRoot, + 'node_modules', + '@powerhousedao', + 'design-system', + ), '@powerhousedao/scalars': join( projectRoot, 'node_modules', '@powerhousedao', 'scalars', ), + react: join(projectRoot, 'node_modules', 'react'), + 'react-dom': join(projectRoot, 'node_modules', 'react-dom'), }, }, plugins: [ diff --git a/studio/vite-plugin.ts b/studio/vite-plugin.ts index 9778640e..6b0465b0 100644 --- a/studio/vite-plugin.ts +++ b/studio/vite-plugin.ts @@ -174,7 +174,12 @@ export function viteConnectDevStudioPlugin( return [ enabled && - viteIgnoreStaticImport([externalImports, '@powerhousedao/scalars']), + viteIgnoreStaticImport([ + 'react', + 'react-dom', + '@powerhousedao/scalars', + '@powerhousedao/design-system', + ]), { name: 'vite-plugin-connect-dev-studio', enforce: 'pre', diff --git a/vite.renderer.config.mts b/vite.renderer.config.mts index 6adbde69..d7a99291 100644 --- a/vite.renderer.config.mts +++ b/vite.renderer.config.mts @@ -12,7 +12,25 @@ import pkg from './package.json'; import { externalIds, viteConnectDevStudioPlugin } from './studio/vite-plugin'; const isBuildStudio = process.env.BUILD_STUDIO === 'true'; -const buildStudioExternals = isBuildStudio ? ['@powerhousedao/studio'] : []; +const buildStudioExternals = isBuildStudio + ? [externalIds, '@powerhousedao/studio', '@powerhousedao/design-system'] + : [externalIds]; + +const reactImportScript = ` + +`; + +process.env.VITE_IMPORT_REACT_SCRIPT = isBuildStudio ? '' : reactImportScript; export default defineConfig(({ mode }) => { const isProd = mode === 'production'; @@ -109,7 +127,7 @@ export default defineConfig(({ mode }) => { ? `${chunk.name}.js` : 'assets/[name].[hash].js', }, - external: ['node:crypto', externalIds, ...buildStudioExternals], + external: ['node:crypto', ...buildStudioExternals], }, }, resolve: {