Skip to content

[Bug]: Support vanilla ESM modules #8639

Closed
Closed

Description

@sandstrom

Added based on request from Eric Horodyski

https://outsystems.canny.io/capacitor-feature-requests/p/support-esm-projects-type-module-when-loading-capacitorconfigts

Request

Add first-class support for loading capacitor.config.ts in packages that have "type": "module" in their package.json.

Why

More and more teams are migrating their codebases to ESM.

Today, a package that contains a Capacitor app cannot opt into "type": "module" because Capacitor's config loader is CommonJS-only — it transpiles the TS config to CJS and loads it via require(). The moment the package is typed as a module, Node classifies every .ts file as ESM and the loader path breaks before user code runs.

The only workarounds are to keep the Capacitor app (and everything next to it) on CommonJS, or to use escape hatches like .cts / .mts extensions and scoped type: "commonjs" overrides. None of these are acceptable for teams going all-in on ESM.

Impact

Unblocks the ESM migration for every team using Capacitor, and brings the CLI in line with the broader Node and TypeScript ecosystem.

Activity

  1. added theissue type on Oct 1, 2026
  2. sandstrom commented on Oct 14, 2026

    @sandstrom
    ContributorAuthor

    @eric-horodyski Does this match what you asked for in the thread cited abovE?

  3. changed the title [-][Bug]: test[/-] [+][Bug]: Support vanilla ESM modules[/+] on Oct 14, 2026
  4. sandstrom commented on Nov 20, 2026

    @sandstrom
    ContributorAuthor

    Great! 💯

    So this is already available in 8.6.2, no need to wait for a new release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    Stage

    Done

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions