Skip to content

Enable import.meta polyfill for Hermes#51

Merged
hotlong merged 2 commits intomainfrom
copilot/fix-hermes-import-meta-issue
Feb 26, 2026
Merged

Enable import.meta polyfill for Hermes#51
hotlong merged 2 commits intomainfrom
copilot/fix-hermes-import-meta-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 26, 2026

@objectstack/core uses import.meta.url which Hermes doesn't support natively. The unstable_transformImportMeta babel polyfill was only enabled under the web key, so iOS/Android builds failed.

Moved the option to top-level babel-preset-expo config so it applies to all platforms:

// before
{ jsxImportSource: "nativewind", web: { unstable_transformImportMeta: true } }

// after
{ jsxImportSource: "nativewind", unstable_transformImportMeta: true }
Original prompt

node_modules/.pnpm/@objectstack+core@3.0.9/node_modules/@objectstack/core/dist/index.js: /Users/steedos/Documents/GitHub/mobile/node_modules/.pnpm/@objectstack+core@3.0.9/node_modules/@objectstack/core/dist/index.js: import.meta is not supported in Hermes. Enable the polyfill unstable_transformImportMeta in babel-preset-expo to use this syntax.
269 | try {
270 | const { createRequire } = await import("module");

271 | this.require = createRequire(import.meta.url);
| ^^^^^^^^^^^
272 | const pino = this.require("pino");
273 | const pinoOptions = {
274 | level: this.config.level,


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…eta support

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix import.meta support issue in Hermes Enable import.meta polyfill for Hermes Feb 26, 2026
@hotlong hotlong marked this pull request as ready for review February 26, 2026 09:31
Copilot AI review requested due to automatic review settings February 26, 2026 09:31
@hotlong hotlong merged commit 3961e16 into main Feb 26, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a Hermes compatibility issue that prevented iOS and Android builds from working. The @objectstack/core@3.0.9 package uses import.meta.url which is not natively supported by Hermes (the JavaScript engine used by React Native). The fix moves the unstable_transformImportMeta Babel polyfill from web-specific configuration to the top-level babel-preset-expo config, enabling it for all platforms including iOS and Android.

Changes:

  • Moves unstable_transformImportMeta: true from nested web object to top-level babel-preset-expo configuration, enabling the import.meta polyfill for iOS/Android platforms in addition to web
Comments suppressed due to low confidence (1)

babel.config.js:14

  • According to the project's custom coding guidelines, development tasks should be followed by running tests and updating the ROADMAP. While this is a build configuration fix that enables iOS/Android builds to work, please verify that:
  1. Tests run successfully with this change (run pnpm test)
  2. Consider adding a note in ROADMAP.md about this Hermes compatibility fix for @objectstack/core@3.0.9

This ensures the project documentation stays current and the change doesn't break existing functionality.

              unstable_transformImportMeta: true,

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants