Skip to content

fix: remove tsx import.meta.dirname workaround, require Cypress >=15.17.0 (v2.1.0)#52

Merged
xfsnowind merged 4 commits into
mainfrom
chore/remove-tsx-import-meta-workaround
Jun 19, 2026
Merged

fix: remove tsx import.meta.dirname workaround, require Cypress >=15.17.0 (v2.1.0)#52
xfsnowind merged 4 commits into
mainfrom
chore/remove-tsx-import-meta-workaround

Conversation

@xfsnowind

Copy link
Copy Markdown
Collaborator

What & why

Reverts the temporary patchImportMeta.ts workaround now that the underlying tsx bug is fixed upstream.

tsx fixed its broken import.meta.dirname/filename handling in tsx 4.21.1 (tsx#781). Cypress bundles the fixed tsx (4.22.4) starting in v15.17.0 — verified that v15.16.0 and earlier still ship the broken tsx 4.20.6. So the shim that patched Module._extensions['.js'] to inject dirname/filename/url into tsx's empty import_meta object is no longer needed.

Changes

  • Remove src/patchImportMeta.ts and its import in src/index.ts; rebuild dist/.
  • Bump cypress devDependency floor to ^15.17.0 (the shim was the only thing keeping older Cypress working).
  • Add peerDependencies: { "cypress": ">=15.17.0" } so consumers get an install-time warning on older Cypress.
  • Bump package version to 2.1.0.
  • Docs: README installation/migration notes + CLAUDE.md updated. Kept dynamic-import.ts and its docs — that helper bridges CJS→ESM loading of rspack v2 / find-up and is unrelated to the tsx bug.

Compatibility

Dropping the shim is breaking for anyone on Cypress 15.9.0–15.16.0 (those bundle the broken tsx and will now fail to start). Such users should stay on cypress-rspack-dev-server@2.0.0. 2.0.0 is already published and cannot be replaced, so this ships as a new version.

Refs:

🤖 Generated with Claude Code

xfsnowind and others added 3 commits June 19, 2026 17:09
tsx fixed import.meta.dirname/filename handling in 4.21.1, and Cypress
began shipping the fixed tsx (4.22.4) starting in v15.17.0. The
patchImportMeta.ts shim that patched Module._extensions['.js'] to inject
dirname/filename/url into tsx's empty import_meta object is no longer
needed.

- Delete src/patchImportMeta.ts and its import in src/index.ts
- Bump cypress devDependency floor to ^15.17.0 (15.16.0 and earlier still
  bundle the broken tsx 4.20.6 and would crash without the shim)
- Update CLAUDE.md: drop the workaround, keep dynamic-import.ts docs
  (that helper bridges CJS->ESM loading and is unrelated to the tsx bug)
- Rebuild dist/

Refs:
- privatenumber/tsx#781
- web-infra-dev/rspack#13420

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a peerDependencies entry on cypress so consumers get an install-time
warning if their Cypress predates the tsx import.meta.dirname fix
(bundled from Cypress 15.17.0 onward). Document the requirement and the
2.0.0 fallback in the README installation and migration sections.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@xfsnowind xfsnowind self-assigned this Jun 19, 2026
@socket-security

socket-security Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcypress@​15.17.0911008495100

View full report

The patchImportMeta.ts module was removed, so its test suite no longer
applies and was failing with ERR_MODULE_NOT_FOUND in CI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@xfsnowind xfsnowind merged commit a8ef8b1 into main Jun 19, 2026
4 checks passed
@xfsnowind xfsnowind deleted the chore/remove-tsx-import-meta-workaround branch June 19, 2026 09:16
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.

1 participant