Skip to content

fix: remove contenthash from output filename to fix 404s in interactive mode#46

Merged
xfsnowind merged 4 commits into
th3fallen:mainfrom
robcmills:fix/contenthash-404
Apr 9, 2026
Merged

fix: remove contenthash from output filename to fix 404s in interactive mode#46
xfsnowind merged 4 commits into
th3fallen:mainfrom
robcmills:fix/contenthash-404

Conversation

@robcmills

@robcmills robcmills commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes two issues causing 404 errors in interactive mode (cypress open):

  1. rspackChunkNamewebpackChunkName: The magic comments in loader.ts used rspackChunkName, which rspack doesn't recognize. Rspack uses webpackChunkName for 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 hardcoded relativeUrl in the loader always 404'd.

  2. 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 with output.uniqueName which namespaces the chunk loading runtime to prevent collisions without requiring filename hashing.

Out of scope

The /__cypress/iframes/undefined 404 mentioned in #45 is a separate issue — a race condition where Cypress's runner constructs the iframe URL before spec.absolute is 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

  • Unit tests pass (pnpm test)
  • cypress run --component passes (headless)
  • cypress open --component — verified spec-0.js 404 is gone
  • cypress run --component in CI — verify no "Loading chunk" errors

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

robcmills and others added 3 commits April 2, 2026 10:54
…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>
Comment thread test/__snapshots__/makeDefaultRspackConfig.spec.ts.snap
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>
@robcmills robcmills requested a review from xfsnowind April 8, 2026 17:56
@xfsnowind xfsnowind merged commit a2db923 into th3fallen:main Apr 9, 2026
4 checks 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.

404 errors in interactive mode: contenthash filename mismatch in loader.js after PR #41

2 participants