Barazo default frontend barazo.forum
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(plugins): restore static import for proper bundling (#201)

* fix(plugins): restore static import for proper bundling + add plugins to CI

The variable import path from bca0280 bypassed webpack bundling,
preventing the plugin module from being included in the client bundle.
Restores the static import so Next.js can resolve and bundle the
plugin frontend at build time.

CI now clones and builds barazo-plugins (frontend only) alongside
barazo-lexicons so TypeScript can resolve the workspace dependency.

* fix(ci): remove plugins cache to ensure fresh clone with latest exports

The cache key was based on pnpm-lock.yaml which doesn't change when
plugins repo changes. Remove caching for now so CI always gets the
latest plugin-signatures with explicit exports entries.

* fix(ci): replace plugin symlink with copy for Turbopack compatibility

Turbopack cannot follow pnpm link: symlinks outside the project root.
After pnpm install creates the symlink, replace it with a real copy
so Turbopack can resolve and bundle the plugin frontend modules.

authored by

Guido X Jansen and committed by
GitHub
4e496387 8202d099

+20 -16
+17
.github/actions/setup/action.yml
··· 25 25 git clone --depth 1 https://github.com/singi-labs/barazo-lexicons.git ../barazo-lexicons 26 26 cd ../barazo-lexicons && pnpm install --ignore-scripts && pnpm run build 27 27 28 + - name: Clone and build barazo-plugins (frontend only) 29 + shell: bash 30 + run: | 31 + git clone --depth 1 https://github.com/singi-labs/barazo-plugins.git ../barazo-plugins 32 + cd ../barazo-plugins && pnpm install --ignore-scripts 33 + cd packages/plugin-signatures && npx tsc -p tsconfig.frontend.json 34 + 28 35 - name: Install dependencies 29 36 shell: bash 30 37 run: pnpm install --frozen-lockfile 38 + 39 + - name: Replace plugin symlinks for Turbopack compatibility 40 + shell: bash 41 + run: | 42 + LINK=node_modules/@barazo/plugin-signatures 43 + if [ -L "$LINK" ]; then 44 + TARGET=$(realpath "$LINK") 45 + rm "$LINK" 46 + cp -r "$TARGET" "$LINK" 47 + fi
+3 -16
src/lib/plugins/loader.ts
··· 20 20 } 21 21 } 22 22 23 - // Map of bundled plugin names to their frontend register module paths. 24 - // Dynamic import uses a variable so TypeScript doesn't statically resolve the 25 - // module — this lets CI pass without the workspace plugin packages checked out. 26 - const BUNDLED_PLUGIN_PATHS: Record<string, string> = { 27 - '@barazo/plugin-signatures': '@barazo/plugin-signatures/frontend/register', 28 - } 29 - 30 - function pluginLoader( 31 - modulePath: string 32 - ): () => Promise<{ register: (r: PluginComponentRegistry) => void }> { 33 - return () => import(/* webpackIgnore: true */ modulePath) 34 - } 35 - 36 23 const BUNDLED_PLUGINS: Record< 37 24 string, 38 25 () => Promise<{ register: (r: PluginComponentRegistry) => void }> 39 - > = Object.fromEntries( 40 - Object.entries(BUNDLED_PLUGIN_PATHS).map(([name, path]) => [name, pluginLoader(path)]) 41 - ) 26 + > = { 27 + '@barazo/plugin-signatures': () => import('@barazo/plugin-signatures/frontend/register'), 28 + } 42 29 43 30 let loaded = false 44 31