[auth/core] "color" ESM only package require in cjs bundle

Hi,
We are trying to bundle our library that uses web3auth packages, but unfortunately the cjs bundle of @web3auth/auth is broken.

It is trying to require a ESM only package called color.
It is required in this file @web3auth/auth/dist/lib.cjs/core/auth.js.

I checked your bundling tool and I think you have to avoid color package to be external in rollup configuration (rollup used to bundle the cjs file).
So rollup will transform this ESM only package to CJS format.

We are using @web3auth v10 packages.

Thank you.

Thanks for reporting this issue, Jean-Benoit!

Here’s a summary of your report for the support team:

  • SDK Used: Web3Auth Plug and Play (PnP) Web SDK
  • Package: @web3auth/auth (CJS bundle)
  • Issue: When bundling your library, the CJS bundle of @web3auth/auth is attempting to require the “color” package, which is ESM-only. This breaks the build process.

Next Steps / Questions

To help us investigate further, could you please provide:

  1. SDK Version Number: Which version of @web3auth/auth are you using?
  2. Bundler Details: Which bundler (Webpack, Vite, etc.) and version are you using for your library?
  3. Error Output: If possible, please share the specific error message or stack trace from your build process.
  4. Minimal Reproduction: If you have a minimal code snippet or repo that reproduces the issue, that would be very helpful.

Additional Context

This sounds like a common issue when a CJS bundle tries to require an ESM-only package. You might want to check our Webpack 5 Troubleshooting Guide and Vite Troubleshooting Guide for possible workarounds or polyfills.


Once you provide the requested details, our team will be able to assist you more effectively. Thank you for your patience!

Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.

Additionally, we would recommend you to join our biweekly Office Hours to get this resolved even faster. Web3Auth Developer Office Hours

@jeanbenoit Are using the @web3auth/auth package in your library?

1 Like

Hi,
Not directly. We are using @web3auth/modal and @web3auth/no-modal, that both requires web3auth/auth

1 Like