Skip to content

fix(rocket): support dependencies in linked installs - #502

Merged
daKmoR merged 1 commit into
modernweb-dev:mainfrom
BeWoFinum:fix/dependency-resolvers
Aug 21, 2026
Merged

fix(rocket): support dependencies in linked installs#502
daKmoR merged 1 commit into
modernweb-dev:mainfrom
BeWoFinum:fix/dependency-resolvers

Conversation

@BeWoFinum

Copy link
Copy Markdown
Contributor

Summary

Fix Rocket dependency and browser asset resolution when Rocket is installed as a linked or nested package.

Previously, several parts of Rocket relied on dependencies being hoisted into the Site Author project. This worked with some npm layouts but failed when Rocket was linked from another directory.

Changes

  • Route generated Markdown SSR imports through @rocket/js/ssr.js.
  • Re-export Lit’s html and SSR render from Rocket.
  • Resolve Rocket-owned icon packages relative to Rocket when unavailable from the Site Author project.
  • Generate Web Dev Server outside-root URLs for assets from linked packages.
  • Prefer browser packages installed in the Site Author project to avoid loading duplicate custom-element packages.
  • Resolve shared packages using browser, import, and module conditions:
    • @floating-ui/dom now uses its ESM entry.
    • nanoid now uses its browser entry instead of importing node:crypto.
  • Fall back to Rocket’s dependencies when the Site Author does not provide a package.
  • Add a patch changeset.

Why

Depending on npm hoisting caused different behavior between regular and linked installations.

Generated modules could require consumers to install Rocket’s transitive dependencies, linked assets returned 404 responses, and duplicate Web Awesome installations attempted to register the same custom elements.

The updated resolution behavior works independently of npm’s physical dependency layout.

Verification

  • Added regression tests for:
    • Generated Markdown SSR imports
    • Rocket-owned icon packages
    • Linked outside-root assets
    • Project package preference
    • Missing-package fallback
    • ESM export conditions
    • Browser export conditions
    • Node built-in exclusion
  • 35 focused tests pass.
  • Type checking passes.
  • ESLint and Prettier pass.
  • Tested against Finum using file:../rocket.
  • Verified the generated Rocket, Lit, Web Awesome, Floating UI, Nano ID, CSS, SVG, and hydration URLs return HTTP 200.

@changeset-bot

changeset-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cfb0543

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@rocket/js Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@daKmoR
daKmoR merged commit 577b522 into modernweb-dev:main Aug 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants