Skip to content

fix: resolve uhk-common Buffer import for file: dependencies#2960

Closed
mondalaci wants to merge 1 commit into
masterfrom
fix/uhk-common-buffer-import
Closed

fix: resolve uhk-common Buffer import for file: dependencies#2960
mondalaci wants to merge 1 commit into
masterfrom
fix/uhk-common-buffer-import

Conversation

@mondalaci

Copy link
Copy Markdown
Member

Summary

Fixes a renderer build failure when uhk-web installs uhk-common via file:../uhk-common.

uhk-common/src/buffer.ts re-exported Buffer through a relative path into its own node_modules:

export { Buffer } from '../node_modules/buffer/index.js';

That works when building inside uhk-common, but npm copies file: dependencies without nested node_modules. Webpack then fails:

Can't resolve '../node_modules/buffer/index.js' in '.../uhk-web/node_modules/uhk-common/dist'

This can surface after any uhk-web npm install that refreshes the local uhk-common copy (e.g. adding a dev dependency).

Changes

  • Import Buffer from the buffer package directly in uhk-common
  • Mark UhkBuffer.stringEncoding as 'utf8' as const for BufferEncoding typing
  • Wrap saved user-config bytes in Uint8Array for Blob construction in the web renderer

Test plan

  • cd packages/uhk-common && npm run build
  • rm -rf packages/uhk-web/node_modules/uhk-common && cd packages/uhk-web && npm install
  • rm -rf packages/uhk-web/.angular/cache && npm run build:renderer succeeds
  • Save user configuration as .bin from the web UI still works

Made with Cursor

uhk-common re-exported Buffer via a relative path into its own
node_modules. When uhk-web installs uhk-common as a file: dependency,
npm copies the package without nested dependencies, so webpack cannot
resolve ../node_modules/buffer/index.js and the renderer build fails.

Import Buffer from the buffer package directly. Tighten stringEncoding
to a const literal for BufferEncoding compatibility, and wrap the saved
user config buffer in Uint8Array for Blob construction.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants