Skip to content

[FIX] Bundler: Improve error ESM handling#1203

Open
matz3 wants to merge 2 commits intov4from
v4-lbt-improvements
Open

[FIX] Bundler: Improve error ESM handling#1203
matz3 wants to merge 2 commits intov4from
v4-lbt-improvements

Conversation

@matz3
Copy link
Copy Markdown
Member

@matz3 matz3 commented Apr 2, 2026

  • [FIX] Bundler: Reduce noise from ESM parse errors
  • [FIX] Bundler: Skip ESM modules during bundling and log errors

See commit messages for details.

matz3 added 2 commits April 2, 2026 16:19
Change the log level for JS parse failures in determineDependencyInfo
from error to verbose. These parse errors occur frequently when a
library contains third-party ESM code (using import/export), which the
LBT bundler does not support. Since these modules are typically not
included in custom bundles, logging at error level creates unnecessary
noise for users.

Errors during actual bundling (e.g. writePreloadModule) are still
reported at the appropriate level.
ESM modules (using import/export) cannot be bundled with the
LBT bundler. Previously, including an ESM module in a preload
section caused the bundle to contain a literal "undefined" string
due to rewriteDefine() returning {} instead of null on parse error.

- Add Format.ESM to ModuleInfo and detect ESM in ResourcePool
  during dependency analysis
- Skip ESM modules in preload, raw, and require sections with
  a descriptive error message
- Exclude ESM modules from bundle subModule metadata
- Fix rewriteDefine() to return null on parse error (safety fix)
@matz3 matz3 requested a review from a team April 2, 2026 14:25
@matz3 matz3 changed the title [FIX] Bundler: Improve ESM handling [FIX] Bundler: Improve error ESM handling Apr 2, 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.

2 participants