From 71517ff1febc6ecfd423d4644244839f3d0996af Mon Sep 17 00:00:00 2001 From: Rob Mills Date: Thu, 2 Apr 2026 10:54:13 -0700 Subject: [PATCH 1/4] fix: remove contenthash from output filename to fix 404 errors in interactive mode The contenthash in output.filename (added in PR #41) caused a mismatch with the hardcoded relativeUrl in loader.ts, resulting in 404 errors for spec files in interactive mode (cypress open). The contenthash cannot be resolved at loader time since the hash depends on the compilation output. Reverting to [name].js since cache busting via filename hashing is unnecessary for a dev server. Closes #45 Co-Authored-By: Claude Opus 4.6 (1M context) --- dist/makeDefaultRspackConfig.js | 2 +- src/makeDefaultRspackConfig.ts | 2 +- test/__snapshots__/makeDefaultRspackConfig.spec.ts.snap | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dist/makeDefaultRspackConfig.js b/dist/makeDefaultRspackConfig.js index 4a4174d..fa2514a 100644 --- a/dist/makeDefaultRspackConfig.js +++ b/dist/makeDefaultRspackConfig.js @@ -26,7 +26,7 @@ function makeCypressRspackConfig(config) { mode: 'development', optimization, output: { - filename: '[name].[contenthash].js', + filename: '[name].js', path: OUTPUT_PATH, publicPath, }, diff --git a/src/makeDefaultRspackConfig.ts b/src/makeDefaultRspackConfig.ts index d6eeded..b42fcc6 100644 --- a/src/makeDefaultRspackConfig.ts +++ b/src/makeDefaultRspackConfig.ts @@ -43,7 +43,7 @@ export function makeCypressRspackConfig(config: CreateFinalRspackConfig): Config mode: 'development', optimization, output: { - filename: '[name].[contenthash].js', + filename: '[name].js', path: OUTPUT_PATH, publicPath, }, diff --git a/test/__snapshots__/makeDefaultRspackConfig.spec.ts.snap b/test/__snapshots__/makeDefaultRspackConfig.spec.ts.snap index 92b604f..198918c 100644 --- a/test/__snapshots__/makeDefaultRspackConfig.spec.ts.snap +++ b/test/__snapshots__/makeDefaultRspackConfig.spec.ts.snap @@ -21,7 +21,6 @@ exports[`makeCypressRspackConfig should return a valid Configuration object 1`] "_events": {}, "_eventsCount": 0, "_maxListeners": undefined, - Symbol(shapeMode): false, Symbol(kCapture): false, }, "files": [], From e8693f878aa0256267295ea8c4dbabf7f4056757 Mon Sep 17 00:00:00 2001 From: Rob Mills Date: Thu, 2 Apr 2026 11:01:52 -0700 Subject: [PATCH 2/4] fix: replace contenthash with uniqueName to fix 404s in interactive mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #41 added [contenthash] to the output filename to fix intermittent "Loading chunk" errors in CI. However, this caused a mismatch with the hardcoded relativeUrl in loader.ts, producing 404 errors in interactive mode (cypress open). The contenthash cannot be resolved at loader time since the hash depends on compilation output which includes the loader output — a circular dependency. The real fix for chunk loading conflicts is output.uniqueName, which namespaces the chunk loading runtime to prevent collisions between the app's rspack/webpack instance and Cypress's, without requiring filename hashing. Closes #45 Co-Authored-By: Claude Opus 4.6 (1M context) --- dist/makeDefaultRspackConfig.js | 1 + src/makeDefaultRspackConfig.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/dist/makeDefaultRspackConfig.js b/dist/makeDefaultRspackConfig.js index fa2514a..ad46e60 100644 --- a/dist/makeDefaultRspackConfig.js +++ b/dist/makeDefaultRspackConfig.js @@ -29,6 +29,7 @@ function makeCypressRspackConfig(config) { filename: '[name].js', path: OUTPUT_PATH, publicPath, + uniqueName: 'cypress-rspack-dev-server', }, plugins: [ new core_1.HtmlRspackPlugin({ diff --git a/src/makeDefaultRspackConfig.ts b/src/makeDefaultRspackConfig.ts index b42fcc6..799169e 100644 --- a/src/makeDefaultRspackConfig.ts +++ b/src/makeDefaultRspackConfig.ts @@ -46,6 +46,7 @@ export function makeCypressRspackConfig(config: CreateFinalRspackConfig): Config filename: '[name].js', path: OUTPUT_PATH, publicPath, + uniqueName: 'cypress-rspack-dev-server', }, plugins: [ new HtmlRspackPlugin({ From 8b43efef299eda6a35b9f23a06149deb8a7d1bf5 Mon Sep 17 00:00:00 2001 From: Rob Mills Date: Thu, 2 Apr 2026 11:23:19 -0700 Subject: [PATCH 3/4] fix: use webpackChunkName magic comment instead of rspackChunkName Rspack recognizes webpackChunkName (for webpack compatibility) but not rspackChunkName. This caused chunks to get auto-generated names (e.g. component_Test_cy_tsx) instead of the intended names (spec-0), making the hardcoded relativeUrl in the loader 404. Co-Authored-By: Claude Opus 4.6 (1M context) --- dist/loader.js | 6 +++--- src/loader.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/loader.js b/dist/loader.js index 640165d..83e9b55 100644 --- a/dist/loader.js +++ b/dist/loader.js @@ -14,7 +14,7 @@ const debug = (0, debug_1.default)('cypress-rspack-dev-server:rspack'); */ const makeImport = (file, filename, chunkName) => { // If we want to rename the chunks, we can use this - const magicComments = chunkName ? `/* rspackChunkName: "${chunkName}" */` : ''; + const magicComments = chunkName ? `/* webpackChunkName: "${chunkName}" */` : ''; return `"${filename}": { shouldLoad: () => { const newLoad = new URLSearchParams(document.location.search).get("specPath") === "${file.absolute}"; @@ -42,7 +42,7 @@ const makeImport = (file, filename, chunkName) => { return newLoad | oldLoad; }, * load: () => { - * return import("/Users/projects/my-app/cypress/component/App.spec.js" \/* rspackChunkName: "spec-0" *\/) + * return import("/Users/projects/my-app/cypress/component/App.spec.js" \/* webpackChunkName: "spec-0" *\/) * }, * chunkName: "spec-0" * } @@ -89,7 +89,7 @@ function loader() { var supportFile = { absolute: ${supportFileAbsolutePath}, relative: ${supportFileRelativePath}, - load: () => import(/* rspackChunkName: "cypress-support-file" */ ${supportFileAbsolutePath}), + load: () => import(/* webpackChunkName: "cypress-support-file" */ ${supportFileAbsolutePath}), } scriptLoaders.unshift(supportFile) } diff --git a/src/loader.ts b/src/loader.ts index e4724b1..bc60124 100644 --- a/src/loader.ts +++ b/src/loader.ts @@ -15,7 +15,7 @@ const debug = debugFn('cypress-rspack-dev-server:rspack') */ const makeImport = (file: Cypress.Cypress['spec'], filename: string, chunkName: string) => { // If we want to rename the chunks, we can use this - const magicComments = chunkName ? `/* rspackChunkName: "${chunkName}" */` : '' + const magicComments = chunkName ? `/* webpackChunkName: "${chunkName}" */` : '' return `"${filename}": { shouldLoad: () => { @@ -47,7 +47,7 @@ const makeImport = (file: Cypress.Cypress['spec'], filename: string, chunkName: return newLoad | oldLoad; }, * load: () => { - * return import("/Users/projects/my-app/cypress/component/App.spec.js" \/* rspackChunkName: "spec-0" *\/) + * return import("/Users/projects/my-app/cypress/component/App.spec.js" \/* webpackChunkName: "spec-0" *\/) * }, * chunkName: "spec-0" * } @@ -99,7 +99,7 @@ export default function loader(this: unknown) { var supportFile = { absolute: ${supportFileAbsolutePath}, relative: ${supportFileRelativePath}, - load: () => import(/* rspackChunkName: "cypress-support-file" */ ${supportFileAbsolutePath}), + load: () => import(/* webpackChunkName: "cypress-support-file" */ ${supportFileAbsolutePath}), } scriptLoaders.unshift(supportFile) } From c0925dd28af271bdc5628bbf74c9462aeb18e39f Mon Sep 17 00:00:00 2001 From: Rob Mills Date: Wed, 8 Apr 2026 10:53:31 -0700 Subject: [PATCH 4/4] fix: revert unrelated snapshot change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Restore Symbol(shapeMode) line in snapshot to match main — the removal was caused by a local Node.js version difference and is unrelated to the contenthash fix. Co-Authored-By: Claude Opus 4.6 (1M context) --- test/__snapshots__/makeDefaultRspackConfig.spec.ts.snap | 1 + 1 file changed, 1 insertion(+) diff --git a/test/__snapshots__/makeDefaultRspackConfig.spec.ts.snap b/test/__snapshots__/makeDefaultRspackConfig.spec.ts.snap index 198918c..92b604f 100644 --- a/test/__snapshots__/makeDefaultRspackConfig.spec.ts.snap +++ b/test/__snapshots__/makeDefaultRspackConfig.spec.ts.snap @@ -21,6 +21,7 @@ exports[`makeCypressRspackConfig should return a valid Configuration object 1`] "_events": {}, "_eventsCount": 0, "_maxListeners": undefined, + Symbol(shapeMode): false, Symbol(kCapture): false, }, "files": [],