Files
cloudflare__vinext/tsconfig.json
T
Divanshu Chauhan (divkix) 2c852d13fc fix: replace relative shim imports with bare specifier vinext/shims/X (#1001) (#1006)
* 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>
2026-05-02 16:32:53 +00:00

19 lines
484 B
JSON

{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"jsx": "react-jsx",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"noEmit": true,
"paths": {
"vinext/shims/*": ["./packages/vinext/src/shims/*"]
}
},
"exclude": ["node_modules", "dist", "fixtures", "tests/fixtures", "benchmarks", "examples"]
}