mirror of
https://github.com/cloudflare/vinext.git
synced 2026-09-14 19:04:59 +08:00
2c852d13fc
* fix: replace relative shim imports with bare specifier vinext/shims/X (#1001) Internally, server modules imported their own 'use client' shims via relative paths (e.g. from "../shims/slot.js"). @vitejs/plugin-rsc's packageSources tracking only fires for bare specifier imports, so relative shim imports took a broken fallback path generating absolute filesystem paths that fail against the package's exports field. Changes: - 67 relative shim imports across 34 source files rewritten to "vinext/shims/<name>" - Added .tsconfig paths mapping so TypeScript resolves shim types to source (avoids type mismatch between dist and source module graphs) - Added vitest project-level resolve aliases for vinext/shims -> source (prevents separate module graph instances in unit tests) - Added package.json exports for ./dist/shims/*.js as a safety net - Added regression test (tests/shim-imports.test.ts) that asserts no relative shim imports exist in source * fix: address review feedback for relative shim imports (#1006) - Convert missed side-effect import in dev-server.ts to vinext/shims/router-state - Extend regression test regex to catch bare side-effect import statements - Remove redundant ./dist/shims/*.js exports from package.json * replace test with oxlint plugin --------- Co-authored-by: James <james@eli.cx>