Commit Graph

6 Commits

Author SHA1 Message Date
Divanshu Chauhan (divkix) fef54db9b4 fix: skip MDX files during RSC scan-build to prevent parse errors (#668)
* fix: skip MDX files during RSC scan-build to prevent parse errors (issue #659)

Adds a vinext:rsc-scan-mdx-guard plugin that runs with enforce:"pre"
to ensure MDX files are skipped before rsc:scan-strip processes them.
This prevents es-module-lexer parse errors when MDX files contain
frontmatter (---) or JSX that isn't valid JavaScript syntax.

Also adds a regression test that uses MDX files with YAML frontmatter
loaded via import.meta.glob to verify the build succeeds.

* fix(mdx): return stub module for undetected MDX files during scan-build

The guard plugin was a no-op that passed raw MDX through unchanged. When
rsc:scan-strip received this raw MDX, es-module-lexer.parse() failed on
frontmatter (---) and JSX syntax.

The real fix is in vinext:mdx: when mdxDelegate is null (no MDX files in app/
or pages/), return a valid JS stub module instead of undefined. This handles
MDX files that enter the build graph via import.meta.glob outside app/pages.

- Remove vinext:rsc-scan-mdx-guard plugin (was a no-op)
- Modify vinext:mdx to return stub module when mdxDelegate is null
- Remove app/mdx-probe/page.mdx from test (was hiding the bug)
- Replace fragile '---' assertion with specific frontmatter checks

Fixes issue #659

* fix(mdx): lazily compile globbed mdx imports

Compile plain .mdx files on demand when they enter the graph via import.meta.glob outside app/pages so scan-build stops crashing without discarding runtime content. Restore the existing happy-path MDX fixture, add focused lazy-compilation coverage, and extract shared Cloudflare fixture setup to keep the regression tests honest.

* fix review issues

* fix: use absolute path for root tsconfig alias to fix import.meta.glob resolution

toViteAliasReplacement was returning "/" (Vite root-relative convention) when
the tsconfig path alias pointed to the project root (e.g. "@/*": ["./*"]).
This worked for regular imports but broke import.meta.glob because Vite's
glob plugin resolves patterns via this.resolve(), which couldn't properly
resolve the "/" replacement to matching filesystem files.

Changed to return the absolute path instead, which works correctly for both
regular imports and glob pattern resolution.

Signed-off-by: Divanshu Chauhan <divkix@divkix.me>
Made-with: Cursor

* refactor: address review feedback on MDX lazy initialization

- Add clarifying comments for mdxDelegatePromise caching semantics
- Document subtle control flow when hasUserMdxPlugin is true
- Suppress duplicate warning on on-demand MDX init (only warn during detection)
- Add case-insensitive extension check in transform hook
- Add test for query parameter edge cases (?raw, ?v=123, etc.)

* refactor: address review feedback on MDX handling

- Merge duplicate query-param MDX skip tests in pages-router.test.ts
- Tighten hasUserMdxPlugin control flow comment for clarity
- Make scanDirForMdx case-insensitive to align with transform check

Refs: PR #668 review feedback

* docs: clarify mdx delegate fallback comment

* chore: trigger ci

---------

Signed-off-by: Divanshu Chauhan <divkix@divkix.me>
2026-03-29 19:51:50 +01:00
Steve Faulkner 5f1681bce7 Fix tsconfig alias transforms for RSC builds (#655)
* Fix tsconfig alias transforms for RSC builds

* Fix flaky compressed streaming timing test
2026-03-22 14:07:29 -05:00
Steve Faulkner 9c2fd26990 docs: update Vite 8 guidance (#596) 2026-03-19 20:44:29 -05:00
Stephen Zhou 1d92846d70 fix: support @voidzero-dev/vite-plus-core as vite alias (#559)
* fix: support @voidzero-dev/vite-plus-core as vite alias

* update

* Update

* Tweaks
2026-03-17 10:49:54 +00:00
Stephen Zhou c17d6941be chore: migrate to vite plus (#535)
* chore: migrate to vite plus

* Disable typeAware and typeCheck

* Update CI

* Fix CI

* Fix test

* Clean

* Run test with vp

* Try revert

* react: false In test

* Fix test

* Revert "Try revert"

This reverts commit 009da10473.

* Update

* Update

* Try revert ci changes

* revert

* Run vp migrate

* Disable typeAware and typeCheck for now

* Better resolve for test

* Use vp dev instead of vite

* Update expect

* Fix NormalizeManifestModuleId

* Try increase timeout

* Update to use vp

* Try new check

* Bring back npx vp

* Migrate CI

* Make next-intl resolvable

* Update

* Update

* Update
2026-03-15 10:50:13 +00:00
Stephen Zhou 5909e005dd feat: support vite8 resolve.tsconfigPaths (#494)
* feat: support vite8 resolve.tsconfigPaths

* Update
2026-03-12 09:29:02 +00:00