Skip to content

Generated TS clients emit ESM interop warning re-exporting @stellar/stellar-sdk #493

Description

@oceans404

Summary

All TS client packages generated by stellar scaffold (via npm run dev or equivalent) produce a Vite warning at runtime:

Unable to interop `export * from "@stellar/stellar-sdk"` in
packages/<contract>/dist/index.js, this may lose module exports.
Please export "@stellar/stellar-sdk" as ESM or use named exports instead,
e.g. `export { A, B } from "@stellar/stellar-sdk"`

The "may lose module exports" language suggests potential silent runtime breakage on certain SDK exports. Worth investigating.

Environment

  • Stellar CLI: v26.0.0
  • stellar-scaffold-cli: v0.0.24
  • @stellar/stellar-sdk: (pulled by template)

Steps to Reproduce

  1. stellar scaffold init my-project
  2. cd my-project && npm install && npm run dev
  3. Wait for clients to generate
  4. Observe warning in Vite output for each generated package

Suggested fix

Update the client generator template to use named re-exports rather than export *:

// instead of:
export * from "@stellar/stellar-sdk";

// use named exports of what the client actually needs:
export { Contract, rpc, xdr } from "@stellar/stellar-sdk";

Note: would like the maintenance label applied to this issue once it's created in the repo.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions