Add rwsdk (RedwoodJS SDK) support to @navita/vite-plugin#72
Merged
Conversation
🦋 Changeset detectedLatest commit: 9a560b2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Co-authored-by: Zn4rK <[email protected]>
Copilot
AI
changed the title
[WIP] Add rwsdk support to @navita/vite-plugin
Add rwsdk (RedwoodJS SDK) support to @navita/vite-plugin
Jan 22, 2026
Zn4rK
approved these changes
Jan 22, 2026
Contributor
|
@copilot Add documentation. Look at "documentation/200-integrations/250-remix.md" and create "240-rwsdk.md" |
Contributor
|
@copilot Add a changeset as well. |
Co-authored-by: Zn4rK <[email protected]>
Contributor
Author
Added documentation at |
Zn4rK
approved these changes
Jan 22, 2026
Co-authored-by: Zn4rK <[email protected]>
Contributor
Author
Zn4rK
approved these changes
Jan 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
src/rwsdk.ts- Main rwsdk plugin implementation following the pattern in remix.tspackage.json- Add export configuration for@navita/vite-plugin/rwsdkdocumentation/200-integrations/240-rwsdk.mdSummary
This PR adds support for rwsdk (RedwoodJS SDK), a Cloudflare Workers-based SSR framework with a unique build architecture involving client build, worker build, and linker pass.
The new
navitaRwsdk()function:RWSDK_BUILD_PASS=linkerenv var andworkerenvironment)dist/client/.vite/manifest.jsonto find the navita CSS hashed filename/virtual:navita.cssandvirtual:navita.cssreferences in the worker bundle with the actual hashed pathUsage
Original prompt
Feature Request: Add rwsdk (RedwoodJS SDK) Support to @navita/vite-plugin
Background
rwsdk is a Cloudflare Workers-based SSR framework. It has a unique build architecture:
replaces asset placeholders with hashed paths from the client manifest
The Problem
The base navita plugin works correctly for the client build - CSS is emitted and registered in the
Vite manifest at dist/client/.vite/manifest.json. However, when users reference the CSS in their
Document component (the HTML shell), the /virtual:navita.css path isn't replaced with the hashed
filename in the worker bundle.
rwsdk has a built-in Stylesheets component that should handle this via manifest lookup, but it has a
bug where paths don't match (/src/client.tsx vs src/client.tsx). Until that's fixed upstream,
navita needs to handle the replacement directly.
Solution
Create a new rwsdk.ts export similar to remix.ts that:
Implementation Reference
Here's a working implementation tested in a real rwsdk project:
// rwsdk.ts
import * as fsp from "node:fs/promises";
import * as path from "node:path";
import { Plugin } from "vite";
import { navita, Options, VIRTUAL_MODULE_ID } from "./index.mjs";
export function navitaRwsdk(options?: Options): Plugin[] {
let projectRootDir: string;
let base: string;
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.