Skip to content

[WIP] Add type module to package.json for ES module support#1

Merged
mkr-infinity merged 1 commit intomainfrom
copilot/add-type-module-to-package-json
Feb 18, 2026
Merged

[WIP] Add type module to package.json for ES module support#1
mkr-infinity merged 1 commit intomainfrom
copilot/add-type-module-to-package-json

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 18, 2026

Plan: Fix GitHub Actions Build Failure

  • Understand the issue - Metro config uses ES modules but package.json doesn't specify "type": "module"
  • Review current package.json configuration
  • Add "type": "module" field to package.json after "private": true
  • Verify the change doesn't break existing functionality
  • Run any existing tests if available
  • Request code review
  • Run security scan (CodeQL)
  • Verify workflow will work with the change
Original prompt

Problem

The GitHub Actions workflow "Build Release APKs" is failing with the following error:

SyntaxError: Error loading Metro config at: /home/runner/work/matrix/matrix/metro.config.js
Cannot use import statement outside a module

Error Details:

  • Job ID: 64001030721
  • Run ID: 22139861626
  • Commit: 95a47f8
  • Failed task: :app:createBundleReleaseJsAndAssets

Root Cause

The metro.config.js file uses CommonJS syntax (require/module.exports), but Node.js is attempting to load it as an ES module. The workflow includes a step to fix this by converting it to ES module syntax, but the package.json doesn't have "type": "module" configured, causing a mismatch.

Solution Required

Add "type": "module" to package.json to enable ES module support across the project. This will allow the Metro config fix in the workflow to work correctly.

Files to Modify

1. package.json

Add "type": "module" field after the "private": true line:

{
  "name": "expo-app",
  "main": "expo-router/entry",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "scripts": {
    ...
  }
}

Expected Outcome

After this change:

  1. ✅ The Metro config will load correctly as an ES module
  2. ✅ The GitHub Actions workflow will build successfully
  3. ✅ Release APK files will be generated and uploaded as artifacts
  4. ✅ The app remains fully functional with no breaking changes

Verification

The workflow at .github/workflows/blank.yml already includes a "Fix Metro Config" step that converts the file to ES module syntax. Once package.json has "type": "module", this conversion will work properly and the build will succeed.

Additional Context

  • This is a React Native/Expo app (Matrix Solver)
  • The app is fully offline and uses TypeScript
  • Current build system: Gradle with React Native 0.81.5 and Expo 54
  • The workflow builds both iOS and Android bundles, but only generates Android APKs

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@mkr-infinity mkr-infinity marked this pull request as ready for review February 18, 2026 12:53
@mkr-infinity mkr-infinity merged commit d1c5b79 into main Feb 18, 2026
1 check failed
Copilot AI requested a review from mkr-infinity February 18, 2026 12:54
Copilot stopped work on behalf of mkr-infinity due to an error February 18, 2026 12:54
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