Files
lobehub__lobehub/plugins/vite/sharedRendererConfig.test.ts
Innei 6329f97e14 🐛 fix(vite): stop assuming node_modules sits at the repo root (#19325)
* 🐛 fix(vite): resolve the editor provider without assuming node_modules layout

GlobalProvider/Editor.tsx reached @lobehub/editor's provider through a
relative `../../../node_modules/...` path, which assumes node_modules sits at
the repo root. Business-overlay desktop builds mount this repo as the overlay
root's `lobehub/` submodule, so the install hoists to the parent directory and
the path does not exist — every desktop platform failed with UNRESOLVED_IMPORT.

The provider subpath is not in the package's export map, so it still cannot be
imported on its own; the dev-only resolver now runs in builds too and derives
the provider file from the resolved package entry, wherever it lives.

Claude-Session: https://claude.ai/code/session_01LNsSw6SDv3UEGNfBEwPa8S

* 🐛 fix(vite): resolve the @lobehub/ui barrel through the package

The barrel parser reached the package's `es` directory through
`../../../node_modules/@lobehub/ui/es`, which assumes node_modules sits at the
repo root — the same assumption that broke the desktop build. Business-overlay
share builds hoist the install above this checkout, where that path does not
exist and `realpathSync` throws before the plugin can load.

Resolving the package entry instead finds it wherever it is installed. The
plugin is not loaded on the desktop platform, so this never surfaced there.

Claude-Session: https://claude.ai/code/session_01LNsSw6SDv3UEGNfBEwPa8S

* ♻️ refactor(vite): take the editor provider entry @lobehub/editor now exports

@lobehub/editor 4.27.0 exports `./react/EditorProvider`, so the provider no
longer has to be reached by file path and the build-time resolver and its
ambient shim can go. The dev redirect stays: Vite prebundles the provider entry
separately from `@lobehub/editor/react`, which the editors use, and the app
would end up with two EditorContexts.

Claude-Session: https://claude.ai/code/session_01LNsSw6SDv3UEGNfBEwPa8S

* 🐛 fix(desktop): let pnpm find the business-const stub

pnpm does not match the `./stubs/business-const` workspace entry, so an OSS
install from apps/desktop fails to resolve `@lobechat/business-const` — the
package the stub exists to provide — and the desktop build cannot be run
locally at all. Cloud builds resolve the real package from the overlay, and
the renderer redirects the module to `@cloud/business-const` either way.

Claude-Session: https://claude.ai/code/session_01LNsSw6SDv3UEGNfBEwPa8S
2026-09-09 14:54:22 +08:00

10 KiB