Skip to main content
These fixes apply only to the self-bundled @layerswap/widget. The recommended React and JavaScript loaders do not put these dependencies in your bundle.

Vite: process is not defined

Install the Node polyfill plugin:
vite.config.ts

Next.js: Node-only module errors

For webpack builds, disable browser resolution for Node-only modules and externalize optional server packages:
next.config.ts

Next.js: ESM package resolution

The published next builds contain extensionless ESM imports. Without transpilation, Node’s SSR loader can reject an internal import with ERR_MODULE_NOT_FOUND, commonly for a path ending in /knownIds. Add the Widget’s shared packages and every installed @layerswap/wallet-* package to transpilePackages:
next.config.ts
Replace the wallet-package entries with every chain package your host installs; include @layerswap/wallets too if you use the lazy descriptor package. The package names use the published wallet-imtbl-* and wallet-module-* forms. Re-check the module packages against the 2.0.0 release.