rwsdk 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -144,8 +144,11 @@ export const ssrBridgePlugin = ({ clientFiles, serverFiles, }) => {
144
144
  }
145
145
  },
146
146
  async load(id) {
147
+ if (this.environment.name !== "worker") {
148
+ return;
149
+ }
147
150
  const virtualSsrId = normalizeVirtualSsrModuleId(id);
148
- if (virtualSsrId && this.environment.name === "worker") {
151
+ if (virtualSsrId) {
149
152
  const realId = virtualSsrId.slice(VIRTUAL_SSR_PREFIX.length);
150
153
  let idForFetch = realId.endsWith(".css.js")
151
154
  ? realId.slice(0, -3)
@@ -209,6 +212,17 @@ export const ssrBridgePlugin = ({ clientFiles, serverFiles, }) => {
209
212
  s.overwrite(site.start, site.end, replacement);
210
213
  continue;
211
214
  }
215
+ // context(chrisvdm, 24 Jun 2026): JSON and ?raw imports should not
216
+ // be pulled into the SSR subgraph. They are static assets that Vite
217
+ // (and the Cloudflare Vite plugin) can handle directly in the worker
218
+ // environment. Keeping them out of the SSR environment avoids Vite's
219
+ // SSR-only JSON helpers and the ?raw access-denial check.
220
+ if (normalized.endsWith(".json") ||
221
+ normalized.includes("?raw")) {
222
+ const replacement = `import("${normalized}")`;
223
+ s.overwrite(site.start, site.end, replacement);
224
+ continue;
225
+ }
212
226
  // context(justinvdm, 11 Aug 2025):
213
227
  // - We replace __vite_ssr_import__ and __vite_ssr_dynamic_import__
214
228
  // with import() calls so that the module graph can be built
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rwsdk",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Build fast, server-driven webapps on Cloudflare with SSR, RSC, and realtime",
5
5
  "type": "module",
6
6
  "bin": {