fix: remove contenthash from output filename to fix 404s in interactive mode#46
Merged
Merged
Conversation
…eractive mode The contenthash in output.filename (added in PR th3fallen#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 th3fallen#45 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PR th3fallen#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 th3fallen#45 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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) <noreply@anthropic.com>
xfsnowind
reviewed
Apr 7, 2026
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) <noreply@anthropic.com>
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.
Summary
Fixes two issues causing 404 errors in interactive mode (
cypress open):rspackChunkName→webpackChunkName: The magic comments inloader.tsusedrspackChunkName, which rspack doesn't recognize. Rspack useswebpackChunkNamefor webpack compatibility. This caused chunks to get auto-generated names (e.g.component_Test_cy_tsx.js) instead of the intended names (spec-0.js), so the hardcodedrelativeUrlin the loader always 404'd.Remove
[contenthash]from output filename: PR fix: avoid filename conflict #41 added[contenthash]to fix intermittent "Loading chunk" errors, but this created a circular dependency — the loader can't know the contenthash at compile time since the hash depends on the loader's own output. Replaced withoutput.uniqueNamewhich namespaces the chunk loading runtime to prevent collisions without requiring filename hashing.Out of scope
The
/__cypress/iframes/undefined404 mentioned in #45 is a separate issue — a race condition where Cypress's runner constructs the iframe URL beforespec.absoluteis populated. This is a Cypress-side timing issue (not in this plugin) that only occurs in interactive mode and does not affect test execution.Closes #45
Test plan
pnpm test)cypress run --componentpasses (headless)cypress open --component— verifiedspec-0.js404 is gonecypress run --componentin CI — verify no "Loading chunk" errors🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com