Skip to content

fix(resolve): fall back to module entry when browser entry is non-ESM in build#22295

Closed
semimikoh wants to merge 1 commit intovitejs:mainfrom
semimikoh:fix/browser-module-entry-fallback
Closed

fix(resolve): fall back to module entry when browser entry is non-ESM in build#22295
semimikoh wants to merge 1 commit intovitejs:mainfrom
semimikoh:fix/browser-module-entry-fallback

Conversation

@semimikoh
Copy link
Copy Markdown
Contributor

… in build

Summary

  • Packages like roughjs@4.5.2 have browser pointing to an IIFE bundle and module pointing to ESM, with no exports field
  • Rolldown's native resolver picks the browser entry first, which has no ESM exports → MISSING_EXPORT error
  • Vite's tryResolveBrowserEntry already has a heuristic (hasESMSyntax check) to fall back to module when browser is non-ESM, but it
    wasn't being used during Rolldown builds
  • Added a pre-resolve plugin in oxcResolvePlugin that intercepts these cases and routes through Vite's resolver

Test plan

  • Added unit test verifying non-ESM browser entry falls back to module entry
  • Verify with reproduction from MISSING EXPORT #22285 (@visactor/vrender-kitsroughjs@4.5.2)

Fixes #22285

@sapphi-red
Copy link
Copy Markdown
Member

Thanks for the PR, but this is an expected behavior: #22285 (comment)

@sapphi-red sapphi-red closed this Apr 23, 2026
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.

MISSING EXPORT

2 participants