Skip to content

fix: resolve ModuleNotFoundError in ESM environments by generating native bundles#1299

Merged
remarkablemark merged 9 commits intoremarkablemark:masterfrom
Div627:fix/esm-browser-compat
Jan 26, 2026
Merged

fix: resolve ModuleNotFoundError in ESM environments by generating native bundles#1299
remarkablemark merged 9 commits intoremarkablemark:masterfrom
Div627:fix/esm-browser-compat

Conversation

@Div627
Copy link
Copy Markdown
Contributor

@Div627 Div627 commented Jan 19, 2026

What is the motivation for this pull request?

This PR fixes the ModuleNotFoundError encountered in strict ESM environments and web-based bundlers (like CodeSandbox/Sandpack).

The issue was caused by the esm/ directory containing manually created .mjs wrapper files that performed cross-directory imports from the CommonJS lib/ directory using relative paths (e.g., import ... from '../../lib/...'). Many modern bundlers fail to resolve these cross-format internal references.

Fixes #1222

What is the current behavior?

image

CodeSandbox

Checklist:

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.10%. Comparing base (c2ce150) to head (7e46060).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1299   +/-   ##
=======================================
  Coverage   93.10%   93.10%           
=======================================
  Files           7        7           
  Lines         145      145           
  Branches       30       30           
=======================================
  Hits          135      135           
  Misses          8        8           
  Partials        2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

remarkablemark

This comment was marked as resolved.

Copy link
Copy Markdown
Owner

@remarkablemark remarkablemark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@remarkablemark remarkablemark merged commit 7172552 into remarkablemark:master Jan 26, 2026
6 of 7 checks passed
@remarkablemark
Copy link
Copy Markdown
Owner

Looks like this caused a regression #1317

@remarkablemark remarkablemark mentioned this pull request Jan 30, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

「ESM build」Broken relative import in /esm/client/html-to-dom.mjs under strict ESM resolvers (CodeSandbox / Webpack5 experiments)

2 participants